Cairo Tests
- Test functions. Tests are #[test] functions: assertions running under Scarb’s test runner.
- should_panic. The should_panic attribute pins failure paths: guards proven to fire.
- Pure-core testing. Pure library logic tests off-chain fast: the contract shell kept thin around it.
Starknet Contract Tests
- Foundry for Starknet. Contract suites run on Starknet Foundry: deploy, call and assert against a local network.
- Cheatcodes. Cheatcodes bend the world: caller addresses, timestamps, block numbers: scenarios scripted.
- Fork testing. Fork tests run against real network state: integrations proven against live protocols.
Failure and Edge Cases
- Panic-path coverage. Every assert and panic is exercised: the security surface is the failure paths.
- Fuzzing. Fuzz tests hammer entry points with random inputs: edge cases surfaced nightly.
- Invariants. Invariant thinking holds here too: supply conserved across any call sequence, tested.
Before and after this level
- Before: Level 9: Accounts & Transactions: Starknet Accounts, Transactions, Fees and Execution.
- Next: Level 11: Security: Access Control, Contract Threats, Secure Starknet Design.
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 Cairo Level 10: Testing cover?
Cairo Tests, Starknet Contract Tests, Failure and Edge Cases: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 9: Accounts & Transactions, which covers Starknet Accounts, Transactions, Fees and Execution.