Approval, golden-master and snapshot testing
An approval test compares a big output with a saved copy. It shows what changed, not whether the old copy was right, so a person must review the first copy and each change.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: comparing two photos of a cake. You photograph the finished cake. A week later you photograph the new one and lay the two side by side. If they match, nothing changed. But the photo does not say the cake tastes good. It only says it looks as it did.
Daily List is a to-do list app. It sends a weekly report as a short text. Tom, the tester, wants to check the text with one check and not many small ones. Leo, the developer, may change the wording of the report next month.
Tom saves the report as an approved copy. An compares output with a saved copy that a person has approved. The saved copy is the , the copy of today's output that later runs are compared with. A tool can check the copy on every build. That is a snapshot test, an automatic check that output still equals a saved snapshot.
If the text changes, the test fails and shows what moved. A person then says if the change is wanted.
The picture has a limit. A photo records how the cake looks. A test must also know if the first photo was of a good cake.
(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)
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 Comparing a big output with a saved copy, while reviewing the first copy and each change against a rule.
- Save the copy
- Check it by a rule
- Review each change
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| Photo of last week's cake | The golden master |
| Photo of this week's cake | Today's output |
| Laying the photos side by side | The comparison and the difference view |
| Tasting the cake | Checking against a rule |
WHERE THIS PICTURE STOPS
- A photo does not show taste. A copy does not show that the output is right.
- A cake looks the same each time. Output may hold times and ids that change.
- A baker tastes once. A team must review every change to the copy.
HOOK
Same as before is not the same as right.
REMEMBER IT THIS WAY
A contrast: two neighbours told apart by one test.
A matching snapshot says the report looks as before. It does not say the report is right, so check the first copy against a rule.
| In the trick | What it stands for |
|---|---|
| Same as before | Today's output equals the golden master |
| Right | Checked against a rule, like tasting the cake |
TELL A FRIEND
An is two cake photos side by side: it shows what changed, not whether the cake tastes good.
OFTEN MIXED UP WITH How do you know the right answer? Test oracles. The oracle lesson asks how to judge a result. A saved copy is an oracle that only says the compared representation matches, so a rule must judge the first copy.
PRACTISE AND KEEP
Sources for this topic — 5 sources
- Market practice
approvaltests (Python package description, Python Package Index) ↗ — Python Package Index (approvaltests project) · Approval tests compare output with a stored approved file, the golden master; if none exists the current output can be recorded; when output changes a diff opens and the person accepts it or fixes the code (search excerpt of a package page, official site not returned)
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
Snapshot Testing (Jest documentation) ↗ — Jest (OpenJS Foundation) · Snapshot files belong in version control and are reviewed like code; a failing snapshot is either a bug or an intended change; do not regenerate snapshots by reflex; keep them small (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
Characterization testing (InfoQ news item on Michael Feathers' idea) ↗ — InfoQ · Michael Feathers coined characterization tests: tests that record what code actually does, as a safety net before changing legacy code (search excerpt of results, wording of the page itself not seen)
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
Using Heuristic Test Oracles (Michael Kelly) ↗ — InformIT · Heuristic oracles are ways to judge a result that can be fallible (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: article as listed on the publisher's site. 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. Author attribution corrected from the author’s own bibliography https://www.michaeldkelly.com/articles, opened6 November2026. The InformIT article now redirects to its generic article index; article contents remain excerpt-only.
- Market practice
Snapshot Testing: Jest 30.0 ↗ — Jest / OpenJS Foundation · Publisher material opened 6 November 2026; version and scope recorded in source registry and domain audit. Synthetic Daily List outcomes follow the stated teaching contract.
Version 30.0 official manual opened 6 November 2026. Paraphrased for teaching; no licence claim.
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.