liveBook · Manning

Snapshot comparison

Also called snapshot testing, approval testing

Snapshot comparison is a technique that compares a current output or state with a previously recorded representation to identify differences.

How 4 Manning books explain it

Learn Go with Pocket-Sized Projects

A golden file is a test fixture containing expected output that is compared with output produced by software.

How it is used
Validates generated HTTP or text output against a maintained expected artifact.
How deep it goes
Defines the fixture workflow and demonstrates strict equality, but stops short of more selective HTML assertions.
Examples
Uses an HTML index response, testdata/index.html, httptest.NewRecorder, os.ReadFile, and strict string equality.
What you can do after
Apply it via Go tests to detect changes in generated responses and diagnose failures caused by unexpected output or whitespace.

Read how Learn Go with Pocket-Sized Projects explains snapshot comparison →

Effective Behavior-Driven Development

Approval testing verifies structured results by comparing them with a previously approved result and reporting detected differences.

How it is used
Simplifies assertions on complicated outcomes such as reports, images, PDFs, and structured data.
How deep it goes
Defines comparison, review, and approval, and explains readable conversions for hard-to-compare outputs without detailing a specific library implementation.
Examples
Uses a weekly pizza-sales report to show approved output and differences in daily and total figures.
What you can do after
Evaluate a detected difference manually, then approve the new result or treat it as an error to fix.

Read how Effective Behavior-Driven Development explains snapshot comparison →

Vibe Engineering

A golden file is an approved reference-output file against which subsequent program output is compared.

How it is used
Detects unintended output changes by comparing current results with stored, previously verified outputs.
How deep it goes
Explains baseline creation, repeated comparisons, human approval, and limits; stops short of proving output correctness.
Examples
Uses markup-parser outputs and UI screenshots as candidate baselines for comparison and review.
What you can do after
Diagnose/debug with it by spotting changed parser outputs or UI screenshots, then investigating whether each difference is unintended.

Read how Vibe Engineering explains snapshot comparison →

Fast by Default

Snapshot comparison is a technique that compares recorded program states at different times to identify changes in resource usage.

How it is used
Tracks memory and resource growth during extended application use before users encounter delayed performance.
How deep it goes
Explains baseline timing, interval comparison, budgets, remediation, and verification without detailing profiler internals.
Examples
Uses a 200-image export measured from 180MB to 2.1GB and back to stable usage near 250MB.
What you can do after
Diagnose memory growth with Visual Studio Memory Usage, dotMemory, Xcode Instruments, and lightweight interval logging.

Read how Fast by Default explains snapshot comparison →

Also covered in

What to know first

Related concepts

Questions about snapshot comparison

What is snapshot comparison?

Snapshot comparison is a technique that compares a current output or state with a previously recorded representation to identify differences.

Which Manning books explain snapshot comparison?

Learn Go with Pocket-Sized Projects, Effective Behavior-Driven Development, Vibe Engineering and Fast by Default.

What should I know before learning snapshot comparison?

Manning books that teach snapshot comparison usually introduce assertion first.

What is the difference between snapshot comparison and specification?

Snapshot comparison is a technique that compares a current output or state with a previously recorded representation to identify differences. A specification is a description of the requirements, expected behavior, properties, interfaces, or constraints that a system or component is expected to satisfy.

What is snapshot comparison part of?

Snapshot comparison is part of Jest. Jest is a JavaScript testing framework for defining, running, and asserting automated tests.

What is snapshot comparison also called?

Snapshot comparison is also called snapshot testing or approval testing.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.