Mutation Testing
Mutation testing validates that your tests actually catch bugs — not just achieve coverage.
How it works: The tool mutates your source code (e.g., changes < to <=, True to
False, deletes a line) and re-runs your tests. If tests still pass, the mutant "survived"
— meaning your tests have a blind spot.
The closed loop:
- Write tests
- Run mutation testing
- Examine surviving mutants
- Write additional tests to kill surviving mutants — all surviving mutants MUST be addressed
- Repeat until mutation score is acceptable
Mutation testing MUST be run before claiming "tests are complete."
Platform tools:
| Platform | Tool | Install | Run |
|---|---|---|---|
| Python | mutmut | pip install mutmut |
mutmut run |
| TypeScript/JS | Stryker | npm i -g stryker-cli |
npx stryker run |
| .NET | Stryker.NET | dotnet tool install -g dotnet-stryker |
dotnet stryker |
| Swift | Muter | brew install muter-mutation-testing/formulae/muter |
muter |
| Kotlin/JVM | Pitest | Gradle/Maven plugin | ./gradlew pitest |