Unit and Integration Tests
- Test frameworks. Contract suites run on frameworks like Foundry: tests in Solidity, fast, fork-capable.
- State setup. Tests build scenarios with cheatcodes: prank callers, warp time, deal balances.
- Fork testing. Fork tests run against real chain state: integrations proven against the actual protocols.
Fuzz and Invariant Testing
- Fuzzing. Fuzz tests hammer functions with random inputs: the edge cases you did not imagine, found nightly.
- Invariants. Invariant tests assert what must always hold: total supply conserved across any call sequence.
- Property mindset. Security tests state properties: no sequence of calls may mint value from nothing.
Testing Adversarial Conditions
- Attacker contracts. Suites include attacker contracts: reentering, reverting on receive, lying about returns.
- Failure-path coverage. Every revert path is tested: the error cases are the security surface.
- Coverage honestly. Coverage maps what never executed: untested branches in money code are unpriced risk.
Before and after this level
- Before: Level 10: Gas & EVM Efficiency: Gas Model, Storage and Execution Costs, Optimising Without Sacrificing Safety.
- Next: Level 12: Cryptography & Signatures: Hashing and Signing, Message Verification, Authorisation Patterns.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Solidity Level 11: Testing cover?
Unit and Integration Tests, Fuzz and Invariant Testing, Testing Adversarial Conditions: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 10: Gas & EVM Efficiency, which covers Gas Model, Storage and Execution Costs, Optimising Without Sacrificing Safety.