What does mutation testing reveal that line coverage does not?
Answer
Mutation testing makes small changes to production code and checks whether the tests fail. A covered line can still have weak or missing assertions, while a surviving mutant shows that a plausible behavior change was not detected. Mutation score is a diagnostic signal rather than a universal target because equivalent, irrelevant and expensive mutants still require judgment.
Strong answer includes
- distinguishes executing code from detecting incorrect behavior
- explains killed and surviving mutants
- avoids treating mutation score as an absolute quality number
Practical example
A calculateDiscount function has 100% line coverage, but Stryker mutates the threshold check from greater-than to greater-than-or-equal and no test fails, revealing that the boundary value itself was never actually asserted, only that the function ran without throwing.