0/5
## Introduction to Testing Now we are going to talk about testing our contracts, and how we can write very robust tests that will help us to be confident in our code. Our first workshop is very simple. If we run: ```bash mox test --coverage ``` You should see a list of files with their coverage. We are primarily interested in the `dsc_engine.vy` file which has a coverage of 9%. Your first workshop is very simple, try to get the coverage above 80%. You should not skip this workshop. We really want you to drill in on writing these tests, and understanding them. This is a great time to work with AI, and use AI to write these tests. We are not even talking about fuzz tests yet, just unit tests. If you do get lost, we have a ton of tests in the GitHub repo associated with this section. Feel free to refer to them, pick and choose any number of the tests in here, or multiple of the tests in here. However, do not copy and paste these tests, try to write them yourself. We want you to take at least 30 minutes to an hour to write some tests yourself, so that you really understand what is going on. Pause the course, write some tests, and come back here, or ask questions, or compare. And if you do not understand why some tests are in here, great! Go to the discussions in the course and ask a question, ask your AI, etc. Let's continue.
A practical workshop for writing unit tests in Python for a Solidity smart contract. This lesson will cover best practices for testing smart contracts, using real-world examples to guide you through the process.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
How to build a DeFi stablecoin and customized NFT
How to deploy your smart contract on ZKsync with Moccasin
Advanced testing techniques like stateful and stateless Python fuzzing
How to write algorithmic trading scripts in Python
Hashing signatures, proxies, delegate calls, upgradable contracts, random numbers, and more!
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on April 21, 2025
Duration: 2h 21min
Duration: 1h 58min
Duration: 2h 55min
Duration: 1h 55min
Duration: 46min
Course Overview
About the course
How to build a DeFi stablecoin and customized NFT
How to deploy your smart contract on ZKsync with Moccasin
Advanced testing techniques like stateful and stateless Python fuzzing
How to write algorithmic trading scripts in Python
Hashing signatures, proxies, delegate calls, upgradable contracts, random numbers, and more!
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on April 21, 2025