Identify Anti-patterns within Smart Contract Testing

InstructorNoah Hein

Share this video with your friends

Send Tweet

Now that we tested a smart contract in solidity with fuzzed inputs, we'll move on to testing our smart contracts in an idiomatic fashion. We will delete the negative test case for the decrement function, and will replace it with a function that expects a specific error instead of any generic failure. The vm object is used to do this, and we'll pick up on the vocabulary word "cheatcode" which is a reference to the various utilities that forge provides you through the vm object.

Here are more examples of how cheatcodes are used.

And here is the reference sheet for an overview of all the available cheatcodes.