mutation-testing
Installation
SKILL.md
Mutation Testing
Overview
Mutation testing evaluates the true quality of your test suite by deliberately introducing faults ("mutants") into your production code. If your tests still pass after code is broken, your tests have blind spots.
Key Concepts
- Mutant: A modified version of production code containing a single syntax or logical change.
- Killed Mutant: A test fails when run against the mutated code (SUCCESS — your tests detected the bug).
- Survived Mutant: All tests pass despite the broken code (FAILURE — test suite missed the bug).
- Mutation Score:
(Killed Mutants / Total Mutants) * 100%. A far more accurate indicator of test effectiveness than vanity code coverage.
Common Mutation Operators
- Conditional Boundary Replacement:
>replaced with>=,<with<=. - Boolean Operator Flipping:
&&replaced with||,truewithfalse. - Arithmetic Operator Replacement:
+replaced with-,*with/. - Statement Removal: Removing a function call or early return statement.
- Return Value Replacement: Returning
null,0, or empty string instead of computed value.