What Is Mutation Testing?
Mutation testing evaluates the quality of a test suite by asking: "Would my tests detect a small bug in the code?" It works by:
- Creating "mutants" -- copies of the source code with one small change (e.g., > changed to >=, + changed to -)
- Running the full test suite against each mutant
- A mutant that causes at least one test to fail is "killed" (test suite detected the bug)
- A mutant that passes all tests is "survived" (test suite missed this bug)
Mutation score = Killed / Total mutants
A test suite with 100% coverage but low mutation score has tests that execute code without asserting correctness -- a common failure mode in automotive test suites where assertions are too loose.