Skip to content
← The curriculum

Snapshots and breadth

One assertion that kills everything is not the same as a suite that checks everything.

There is an obvious way to game a mutation score: serialise the entire output of every function and compare it to a blob. Any change to anything makes the blob differ, so almost every mutant dies.

The score goes up. The suite gets worse.

A whole-output comparison fails for every change, which means it tells you *that* something moved and never *what* or *why*. When it goes red — and it goes red constantly, for changes that are entirely intentional — the cheapest response is to regenerate it. A snapshot that gets regenerated on every failure has stopped being a test and become a record of the last time somebody pressed the button.

1 of 3