What is mutation testing and why is it useful?
- mutation testing
- test effectiveness
- Stryker
Answer it first, then compare. Nothing here is saved or scored.
Model answer
Mutation testing modifies (mutates) your source code in small ways, changing `>` to `>=`, `true` to `false`, removing a line - then runs your tests. If tests still pass with the mutation (a "survivor"), your tests missed that behavior. It measures test effectiveness, not just coverage. Tools: Stryker (JavaScript/TypeScript), PIT (Java). It's slow (runs tests many times), so use on critical modules, not the entire codebase. A high mutation score (>80%) means your tests actually catch bugs, not just execute code.
What interviewers listen for
- Risk-based prioritisationYou can defend skipping coverage on a path because the risk maths supports it.
- Test design fluencyYou apply equivalence partitioning and decision tables to concrete inputs in real time.
- Metric judgmentYou distinguish between metrics that drive learning and metrics that drive theatre.
- Strategy under constraintYou can produce a defensible plan when the team has half the time and twice the scope.