TOPIC 39/5114 MINNOT STARTED

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.

  1. Save the copy
  2. Check it by a rule
  3. Review each change
One warning

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
Photo of last week's cakeThe golden master
Photo of this week's cakeToday's output
Laying the photos side by sideThe comparison and the difference view
Tasting the cakeChecking 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.

What each part of the trick stands for
In the trickWhat it stands for
Same as beforeToday's output equals the golden master
RightChecked 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
  1. 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)

    Per the search excerpt, approval tests compare output with a stored approved file, called the golden master. If none exists, the current output can be recorded. When output changes, a diff opens and the person either accepts the new output or fixes the code. The official site was not returned. Practitioner guidance, not a standard. · Checked 2026-10-18

    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.

  2. 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)

    Per the search excerpt, 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 snapshots small. · Checked 2026-10-18

    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.

  3. 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)

    Per the search excerpt of search results, Michael Feathers coined characterization tests: tests that record what code actually does, not what it should do, as a safety net before changing legacy code. This page was one of several returned; its own wording was not seen. Practitioner guidance, not a standard. · Checked 2026-10-18

    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.

  4. 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)

    Practitioner article; cite for the idea that oracles are able to be wrong heuristics that suggest a problem rather than prove one. · Checked 2026-11-06

    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.

  5. 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.

    Human review, scoped snapshots and deterministic clock. A matching representation does not prove all product behaviour is unchanged. · Checked 2026-11-06

    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.