Staging or production: where to run each test

Which tests belong on a preview, which on staging and which on the live site, what each can and can't tell you, and how to test production without leaving a mess.

Checked 24 November 20262 min read

Most sites exist in more than one place: a preview for each pull request, a staging copy, and the live site. They are the same code at different moments, with different data behind them, so the same test tells you something different on each.

What each copy can tell you

CopyGood forBlind to
Previewthis one change, before it mergesreal data, and other people's changes
Stagingeverything together, before a releaseproduction's data, settings and scale
Live sitewhat visitors actually getnothing, but it's too late to prevent it

Test changes where they're cheap to fix

Run the flows that make things (sign-ups, orders, bookings) on previews and staging, where a test order is nobody's problem. That is also where a failure should be allowed to stop a release.

Test production gently

The live site still needs testing: its settings differ, a third-party script updates, a certificate expires. Keep to tests that read rather than write: pages open, a test account signs in, the checkout is reached without paying. Run them after each deploy and every day.

Keep the copies alike

A test on staging is worth only as much as staging is like production. The same build, the same settings where you can, and test accounts that exist on both (test accounts for sign-in).

When staging passes and production fails

Look at what differs: environment settings, data, a cache, third-party keys. The error names the request or the step that failed. Compare that one thing across the two.

Related guides