Elementary, my dear tester: Mutation testing exposes the fragility of your test suite by injecting faults (mutants) into your code. A robust regimen ensures efficiency, reliability, and actionable insights. Below, I outline a comprehensive design covering budgets (to control costs), flakes isolation (to eliminate noise), and reporting (for forensic analysis). This is tailored for CI/CD pipelines using tools like PIT (Java), Stryker (JS/TS), or Mutmut (Python).
1. Budgets: Resource Containment
Mutation testing is computationally expensive (10-100x slower than normal tests). Enforce strict budgets to fit within CI minutes (e.g., 10-30 min per run).
Time Budget:
Scope
Limit
Rationale
Full Suite
20 min
CI slot max; timeout kills run.
Incremental (changed files only)
5 min
PR checks; use git diff.
Nightly Full
60 min
Deeper analysis on main branch.
Mutant Budget:
Max 1,000-5,000 mutants per run (prioritize by code coverage >80%).
Per-module cap: 500 mutants/module.
Survival threshold: Abort if >10% survive after 50% budget exhaustion (indicates poor tests).