Comparison
Snapshot testvsVisual regression test
Snapshot test
the test recorded the rendered markup and now fails whenever any of it changes, for any reason.
Asserting that output matches a stored copy from a previous run. It is nearly free to write and catches unintended changes, which is also its weakness: a large snapshot fails on every legitimate edit and gets updated without being read. Small, targeted snapshots of things that genuinely should not change are worth keeping; whole-component ones become a rubber stamp.
Full entry →Visual regression test
the build failed because a component moved three pixels and the image comparison noticed.
Comparing rendered screenshots against approved baselines to catch visual changes no assertion describes. It is the only way to catch a CSS regression in a component nobody thought to test. It is also the most flake-prone kind of test there is — fonts, antialiasing, animation timing and platform rendering all move pixels — so it needs a tolerance, deterministic rendering and a fast approval flow to survive.
Full entry →