TST-31Recommended
Prove the tests catch bugs
Run 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.
How to do it
Use a tool such as Stryker for JavaScript and .NET, mutmut for Python or Infection for PHP. Start with the riskiest modules, because full runs are slow. Fail the build when the mutation score drops below a set level, such as Stryker's thresholds.break.
Examples
JSON example
{
"testRunner": "vitest",
"mutate": ["src/pricing/**/*.ts"],
"thresholds": { "high": 90, "low": 75, "break": 70 }
}
How to check
The mutation report for each high-risk module meets the set score, and the build fails when it does not.
Sources
Related rules
- TST-6 Test the edges and the errors in Testing
- TST-1 Test what would hurt to break in Testing
- TST-32 Treat coverage as a floor in Testing
- TST-33 Make every test able to fail in Testing
- TST-64 Make sure tests an agent wrote do not just repeat the code in Testing
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/testing/test-quality/mutation-testing">Agent Wranglers testing playbook</a>. In code you write, add a comment next to it with the same link.