metric

Mutation Score

The proportion of deliberately introduced faults that the test suite detects — a measure of whether tests would notice a defect, unlike coverage.

Line coverage measures execution, not verification. A suite that runs every line and asserts nothing scores one hundred percent. This is not hypothetical: tests that exercise a path and assert only that no exception was thrown are common, and coverage reports them as protected.

Mutation testing measures the property people actually want. It introduces small faults — invert a condition, change a boundary, remove a statement, replace a return value — reruns the suite, and asks whether anything failed. A mutant that survives is a change to behaviour the tests do not detect.

The output is more actionable than a percentage. Each surviving mutant points at a specific line whose behaviour is unverified, which is usually either a missing assertion or genuinely dead logic. Both are worth knowing.

The cost is real: the suite runs once per mutant, so full analysis is expensive. The practical form is incremental — mutate only the code changed in this pull request — which brings the runtime into pipeline range and concentrates the attention where it belongs.