> [!abstract] > A testing pattern that captures the output of a system as a "snapshot" stored in source control, then diffs against it on subsequent runs — pass if unchanged, fail if different. ## The pattern Two phases: 1. **Record** — run the system and store its output as the approved snapshot 2. **Compare** — on each subsequent run, diff the current output against the stored snapshot; pass if identical, fail if different Eliminates the need to manually specify expected values — useful when output is complex, large, or hard to express as an inline assertion. ## Limitation Produces **two-state output**: pass or fail. A failure means something changed, but gives no guidance on whether the change was intentional or not — that judgment is left entirely to the developer. See also: [[Approval testing]], [[Approval testing vs Snapshot assertion]] ## Sources https://www.danclarke.com/snapshot-testing-with-verify