Approval Testing
Approval testing compares actual output against a reviewed, committed baseline, flagging any difference for human confirmation before it is accepted.
Definition
Approval testing is a technique in which the test records the current output of a unit and compares it with a stored, human-approved baseline, failing when they differ.
Context and scope
It suits complex or opaque outputs such as formatted reports, rendered documents, and legacy code where expected values are hard to state by hand.
Common misconceptions
- approval testing verifies correctness automatically
- approving a diff means the new output is definitely right
Anti-patterns
- bulk-approving a large diff without reading it
- storing baselines without review in version control
Related concepts
Authoritative source
Definition
Approval testing is a technique in which the test records the current output of a unit and compares it with a stored, human-approved baseline, failing when they differ.
It suits complex or opaque outputs such as formatted reports, rendered documents, and legacy code where expected values are hard to state by hand. Compared to simpler alternatives, this concept fits best when the trade-off it represents is the one the system actually cares about.
When to use it
A common use case is applying it at the boundary where the cost of getting it wrong is highest, and the scenario usually involves a concrete guarantee the system must uphold. Unlike an ad hoc approach, it makes that guarantee explicit, reviewable, and testable.
How it works
The baseline is the specification: the test detects change, while a human decides whether the change is desired, which shifts intent into the review step.
Because diffs are explicit, accidental changes surface, but rubber-stamping approvals erodes the value and quietly blesses regressions.
Trade-offs and alternatives
Baselines must live under version control so a change is reviewable, and they should be updated deliberately rather than regenerated automatically on every run. The main drawback is the extra complexity it introduces, so the benefit should clearly outweigh that cost before a team adopts it.
Common misconceptions
A persistent misconception is that approval testing verifies correctness automatically. Another is that approving a diff means the new output is definitely right. For example, an engineer who assumes otherwise may design around a guarantee that does not actually exist, which only becomes obvious under load or failure.
Anti-patterns to avoid
Two recurring anti-patterns are to bulk-approving a large diff without reading it and to storing baselines without review in version control. Both tend to surface as hard-to-debug production issues rather than obvious test failures. Related concepts include Test Parallelization and Sharding, Mock Objects and Behaviour Verification, Golden Master Testing.