Mutation testing
Plant small faults on purpose and see if the tests notice. The share caught tells you how strong the tests are, which coverage cannot.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a teacher plants spelling mistakes in an essay to see if the proofreader finds them. The planted mistakes show which faults this check can detect. Finding them all still does not prove that the original essay has no other errors.
Daily List is a to-do list app. Its tests all pass, and a report says they run every line of the code. Leo asks Tom if that means the tests are good. Tom says: let us find out.
Leo plants a small fault in the rule that decides if a task is overdue. He changes one sign. Then he runs the tests. If a test fails, the tests noticed. If all still pass, investigate whether the change alters reachable behaviour and whether the setup and assertions check it. Some surviving changes are equivalent or irrelevant to the supported domain.
This is mutation testing: planting small faults on purpose to see whether the tests catch them.
The picture has a limit. A teacher plants mistakes by hand. A tool plants hundreds, fast, and a few may not be mistakes at all.
(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)
PLAIN WORDS · 1 in this section
- proofreader
- a person who reads closely to find mistakes before printing
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Testing the tests by planting small faults and seeing which ones are caught.
- Plant a fault
- Run the tests
- Count the kills
- Study the survivors
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| A teacher's planted spelling mistakes | The mutants |
| The proofreader | The tests |
| A mistake that is found | A killed mutant |
| A mistake that is missed | A surviving mutant |
WHERE THIS PICTURE STOPS
- A teacher plants a few by hand. A tool plants hundreds.
- Some planted changes are not mistakes at all. They are equivalent mutants.
- A proofreader may see the whole page. Tests only check what they were written to check.
HOOK
Plant, run, count the catches.
REMEMBER IT THIS WAY
A story beat: one picture-line that carries the order or the cause.
Leo changes one sign in the overdue rule, and Tom runs the tests to see if any fail.
| In the trick | What it stands for |
|---|---|
| One sign | plants a small fault |
| Tests fail | the fault is caught |
The planted change does not matter in real use, so a survivor is not always a weak test.
TELL A FRIEND
Plant small code changes, see which the tests detect, and read the tool’s counted set before interpreting the score.
OFTEN MIXED UP WITH Unit tests for testers. The unit tests lesson writes the tests. This lesson tests how good those tests are.
PRACTISE AND KEEP
Sources for this topic — 3 sources
- Market practice
An Analysis and Survey of the Development of Mutation Testing (Yue Jia and Mark Harman, journal article, 2011) ↗ — Institute of Electrical and Electronics Engineers (IEEE) · A survey of mutation testing, a fault-based technique that seeds small faults into a program (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Volume 37, issue 5, pages 649 to 678. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Pitest mutation testing home page (pitest.org) ↗ — Pitest project · Faults are seeded and the tests run; a failing test kills the mutant, a passing suite lets it live; quality is the percentage killed; builds can contain equivalent mutations (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Mutant states and metrics ↗ — Stryker Mutator · Opened 21 October 2026: Stryker mutant states and metrics; detected = killed + timeout, valid = detected + survived + no coverage. Compile/runtime errors, ignored and pending are outside this score denominator.
Primary page opened and read on 21 October 2026. Earlier references may describe the access available in their own batch. Paraphrase only.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.