mutation-testing
Mutation testing protocols, evaluating test suite effectiveness, mutant survival analysis, and killing false-positive tests.
SKILL.mdskills/mutation-testing/SKILL.md
GitHubMutation Testing & Test Quality Protocol
Measure the actual defect-detection capability of your test suite beyond simple code coverage metrics.
1. The Mutation Testing Principle
- High code coverage can be misleading if assertions are weak or missing.
- Mutation testing intentionally injects mutants (faults) into production code:
- Replaces comparison operators
- Replaces arithmetic operators
- Inverts boolean conditions
- Removes function calls or return values
- If tests still pass when code is mutated, the mutant survives (identifies an untested boundary).
- If a test fails, the mutant is killed (confirms real assertion coverage).
2. Surviving Mutant Remediation
- When a mutant survives, identify the missing edge-case test.
- Add a targeted test case asserting the specific boundary condition until the mutant is killed.
- Aim for a Mutation Score Indicator > 80% on mission-critical business logic.