BAC-L2-SUB-110Substrate / Polkadot SDK
Testing runtime logic
A runtime bug cannot be hot-fixed on a public chain. Testing is therefore not a good practice but a deployment condition.
- Level
- L2 — Appchain developer
- Duration
- 4 h
- Maintainer
- Polkadot / Substrate Lead Architect
Learning objectives
- 01Build a test environment that reproduces chain state
- 02Cover nominal cases, rejections and boundaries
- 03Turn an incident into a regression test
Guided lab
Raise the pallet's coverage past the required threshold, rejections and bounds included.
Independent lab
State an invariant property of the pallet and check it against randomly generated inputs.
Security angle
Write the failing test first and the fix second: the only proof a flaw is actually closed.
Assessment
Test suite running in CI, with measured coverage.
