Visual Regression Testing
Comparing rendered output against a stored baseline to catch unintended visual change.
Visual regression testing captures a rendering — usually a screenshot, sometimes a serialized tree — and compares it against a stored baseline, failing on difference. It catches the large class of visual defects that no assertion describes, and it is the only practical way to verify a refactor that is supposed to change nothing visible.
Snapshot Testing of serialized output is the same idea in text form, and shares the same weakness: a snapshot records what the code did, not what it should do, so a wrong output is happily enshrined by an unthinking update. Reviewing the diff rather than blessing it is the entire discipline.
For pixel comparison the practical problems are all about determinism. Fonts must be loaded, animation disabled, device pixel ratio fixed, and remote images avoided — any of which will otherwise produce differences unrelated to the change. A useful sanity check is to capture the same code twice and confirm the difference is zero; if it is not, the harness is not measuring the code.
Two traps recur. A static server that rewrites URLs can silently serve an error page for every capture, producing a baseline of identically-sized images that look fine in aggregate — check that file sizes vary. And a wrapper applied to some renders and not others produces an offset that fails everything for one reason.
See also10
Component Story
An isolated rendered instance of a component, usable as documentation, a workbench, and a test.
Testing & Verification17 connections
Headless Browser
A real browser driven programmatically without a visible window.
Testing & Verification14 connections
Regression
A previously working behavior that a change has broken.
Method23 connections
Responsive Breakpoint
A viewport width at which a layout changes, and the assumptions that come with it.
Design & Interface18 connections
Test Fixture
The prepared data or state a test runs against.
Testing & Verification16 connections
Stacking Context
The nested coordinate system that decides what paints above what, and why z-index often does nothing.
Design & Interface21 connections
Integration Test
A test exercising several components together, through real interfaces rather than doubles.
Testing & Verification17 connections
Reproducible Case
The smallest set of steps that reliably produces a fault, and the unit of real debugging.
Method27 connections
Determinism
The property that identical inputs produce identical outputs, and the foundation of caching and verification.
Systems & Tooling61 connections
Regression Testing
Rerunning existing tests after every change to confirm that what used to work still works, how the suite grows one fixed bug at a time, and how teams keep it fast enough to run.
Testing & Verification14 connections
Linked from12
- Component StoryTesting & Verification
An isolated rendered instance of a component, usable as documentation, a workbench, and a test.
- End-to-End TestTesting & Verification
A test that drives the whole running system the way a user would, from the interface down through every real dependency, buying the most confidence at the highest cost.
- Flaky TestTesting & Verification
A test that passes and fails on identical input, and the most corrosive thing a suite can contain.
- Golden File TestingTesting & Verification
Comparing an output against a checked-in reference file the whole team agreed was correct, rather than an inline assertion.
- Headless BrowserTesting & Verification
A real browser driven programmatically without a visible window.
- Integration TestTesting & Verification
A test exercising several components together, through real interfaces rather than doubles.
- RegressionMethod
A previously working behavior that a change has broken.
- Regression TestingTesting & Verification
Rerunning existing tests after every change to confirm that what used to work still works, how the suite grows one fixed bug at a time, and how teams keep it fast enough to run.
- Responsive BreakpointDesign & Interface
A viewport width at which a layout changes, and the assumptions that come with it.
- Snapshot TestingTesting & Verification
Comparing a component or output's current rendering against a saved baseline, flagging any difference for a human to accept or reject.
- Stacking ContextDesign & Interface
The nested coordinate system that decides what paints above what, and why z-index often does nothing.
- Test FixtureTesting & Verification
The prepared data or state a test runs against.