Testing comparisons

Snapshot tests vs. behavioural assertions

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

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.

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
ChangeSnapshot evidenceBehavioural evidence
Markup is restructuredDiff identifies the affected subtree.The correct paid amount remains visible.
Receipt total changesThe reviewer must interpret the changed text.Exact amount assertion gives expected and observed values.
Receipt ID varies on every runUse stable fixture values or a deliberate matcher.Check the agreed format or relevant identity.
Pay action becomes disabledStored 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

Your next release starts here

Keep building.
Put testing to work.

Give Cue April your next testing challenge. Let your AI quality lead coordinate the checks, so your team can focus on what comes next.

Create account

Create your account, connect a repository and review your proposed setup before approving a run.