# Snapshot tests vs behaviour assertions

> Compare a harmless markup change with an incorrect business total. Choose which snapshot differences need review and which values deserve direct assertions.

Source: https://cueapril.com/compare/snapshot-vs-behaviour-assertions
Updated: 2026-12-01
Index: https://cueapril.com/llms.txt

## Which checks should survive a harmless visual refactor but catch an incorrect total?

Use a small snapshot when a reviewer can inspect the entire saved representation and unintended changes to it matter. Use targeted assertions for amounts, accessible labels, enabled actions and state transitions. A page-sized snapshot costs attention every time unrelated markup changes.

Use snapshots for stable output and specific assertions for business rules. A receipt example separates a markup change from an incorrect total.

Cue April editorial assessment. The sources identify documented capabilities. Suggested pilot checks are evaluation criteria.

## Separate the styling change from the pricing error

Imagine a receipt whose layout changes from two wrappers to one. A markup snapshot can show the difference even when the amount stays correct. Now change the price calculation while keeping the old receipt structure. An explicit assertion comparing the displayed and independently expected amounts makes the consequence easy for the reviewer to understand.

Snapshot tests vs. behavioural assertions

| Change | Snapshot evidence | Behavioural evidence |
| --- | --- | --- |
| Markup is restructured | Diff identifies the affected subtree. | The correct paid amount remains visible. |
| Receipt total changes | The reviewer must interpret the changed text. | Exact amount assertion gives expected and observed values. |
| Receipt ID varies on every run | Use stable fixture values or a deliberate matcher. | Check the agreed format or relevant identity. |
| Pay action becomes disabled | Stored output may include an attribute change. | A user-oriented assertion checks whether payment is available. |

## Give snapshot updates a reviewer

Snapshot acceptance replaces a baseline. Read the old and new values before approving the update, and keep stable input data so timestamps or IDs do not create constant churn. Put the amount and currency into named assertions so an otherwise reasonable template change cannot silently redefine the intended price.

## Primary documentation

- [Jest snapshot testing](https://jestjs.io/docs/snapshot-testing)
- [Playwright assertions](https://playwright.dev/docs/test-assertions)

By Cue April. Updated 2026-12-01.

## Related

- [Testing comparisons](https://cueapril.com/compare): Compare testing tools and methods against a release decision. Inspect the required evidence, maintenance work and checks each approach can provide.
- [Unit testing](https://cueapril.com/testing/unit-testing): Unit testing explained, with examples. Run your Jest or Vitest suites against a pinned code revision and inspect the native results and remaining gaps.
- [Testing comparisons](https://cueapril.com/compare/visual-vs-functional-regression-testing): Compare a screenshot with an assertion about an exported CSV. Check for a clipped button and an unexpected record using evidence suited to each failure.
