Snapshot comparison stores program output as a golden baseline and fails when later output differs. It detects changes, not whether the original output was correct. section 8.3.5
A bad first output can become the standard: later tests may pass while preserving incorrect behavior. Use snapshots to catch regressions only after verifying the baseline independently. section 8.3.5
Approval testing adds explicit human review before outputs become baselines. For visual regression, reviewers inspect rendered screenshots and approve acceptable changes; stable screenshots alone do not establish good design. section 8.3.6 section 8.3.6
Treat tests as contracts that state required behavior independently of implementation. Snapshots capture implementation behavior, so pair them with tests that express requirements directly. section 8.3.7 section 8.3.7
Listing 8.7 Generate golden test set
# First run: generates snapshots
def test_parser_snapshot(snapshot):
inputs = [
"# Header",
"**bold** and *italic*",
"[link](url)",
"Plain text",
"## Header with **formatting**"
]
for i, inp in enumerate(inputs):
snapshot.assert_match(parse_markup(inp), f'output_{i}')A parser test captures outputs for several markup inputs as named snapshots. section 8.3.5



