Can a green, high-coverage suite notice a wrong answer?
Choose coverage to find code and branches your tests have never exercised. Choose mutation analysis to challenge what the suite can detect in a defined scope. Start with uncovered high-consequence paths. Then inspect surviving changes on code you already exercise, especially money, permissions and state transitions.
An executed line can return the wrong amount
Imagine a shipping test calls the fee calculation and checks only that the result is a number. The return line executes, including when a change replaces 499 cents with 0. A targeted assertion of 499 cents below the free-shipping threshold should detect that particular change. This example illustrates the difference before you measure your own suite.
| Release question | Coverage report | Mutation report |
|---|---|---|
| Did the fee branch execute? | Identify the branch and its execution count. | Check whether the generator changed the relevant code. |
| Would a wrong fee fail a test? | Line or branch execution alone leaves this open. | Inspect the deliberate fee change and its outcome. |
| Where should we add an assertion? | Find exercised business rules with little visible checking. | Prioritise harmful survivors and their input conditions. |
| Can we compare releases? | Keep the same coverage type and file scope. | Keep engine, operators, exclusions and outcome definitions. |
Compare the denominators before presenting a trend
Coverage can count executable lines or branch opportunities. A mutation tool counts generated changes under its own status rules and configured scope. Keep the revision, files, exclusions and counts for detected, surviving, uncovered and invalid changes. A higher percentage after dropping a hard-to-test file gives a reviewer a different story from detecting more changes.