What is mutation testing?
Mutation testing measures test quality by introducing small bugs into code and checking whether tests catch them.
A mutation tool changes the code slightly, for example turning > into >= or removing a line, and reruns the tests. If tests still pass, the mutant “survived”, revealing a gap in what the tests check.
It is computationally expensive, so teams usually apply it to critical modules rather than whole codebases.
Example
A mutation changes a discount check from total > 100 to total >= 100. All tests still pass, revealing that nobody tested an order of exactly 100.
Best practices
- Apply to high-risk business logic
- Use surviving mutants to write better assertions
- Run periodically rather than on every commit
- Track mutation score over time
Ship without fear.
Start testing free in minutes, or let a QAShift engineer deliver your first morning report within 5 days.