Test quality
Prove the tests would catch a bug. Use mutation testing, treat coverage as a floor, and review test code as carefully as the code it checks.
- Required 1
- Recommended 4
Required
Make every test able to fail
RequiredEvery test must contain a check that fails when the behaviour breaks. Tests without assertions or with always-true checks are not tests.
Recommended
Prove the tests catch bugs
RecommendedRun mutation testing on the high-risk modules from the risk list. It changes the code on purpose and checks that at least one test fails for each change.
Treat coverage as a floor
RecommendedUse line and branch coverage to find untested code and to stop it falling. Never treat a high number as proof of good tests.
Review tests like code
RecommendedReview test code with the same care as production code. It must be clear, small and free of copy and paste.
Keep snapshot tests small and reviewed
RecommendedUse snapshots only for small, stable output. Review every snapshot change like code, and never accept new snapshots without reading them.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/test-quality.