Skip to main content

Testing Strategy

Why 'It Works in Staging' Keeps Being a Lie: Test Environment Parity

Nebojsa Covic TabasevicOct 20, 20263 min read
Why 'It Works in Staging' Keeps Being a Lie: Test Environment Parity

The release I still think about was a mobile push notification feature that worked perfectly in every staging test we ran. It failed silently for roughly forty percent of production devices within the first day. Staging was using a test certificate that skipped a rate limit the real push notification service enforces in production. Nothing about our tests was wrong. The environment they ran in just wasn't the one that mattered.

The gaps that actually bite

Data volume and shape. A staging database with five hundred rows behaves nothing like production with fifty million, especially for query performance, pagination edge cases, and anything that only breaks once an index stops being enough. A query that returns instantly against a small seeded dataset can be the exact query that times out in production, and staging will never show you that.

Third-party sandbox behavior. Payment and email sandboxes exist to make testing easy, which usually means they skip the real latency, rate limits, and failure modes the live service actually has. A sandbox that always responds in fifty milliseconds tells you nothing about how your code handles the live service on a slow day.

Infrastructure topology. Staging running on a single instance won't reveal a race condition that only shows up once you're load-balanced across several, because the conditions that create the race simply don't exist on one box.

Config drift is the quiet one

Feature flags, environment variables, and API keys that differ between environments, and nobody re-audits after the initial setup. A staging environment quietly running last quarter's configuration isn't testing this quarter's application, no matter how identical the deployed code looks.

What actually closes the gap

Not "make staging identical to production." That's rarely realistic and usually not worth what it costs. What actually helps is knowing precisely where the two differ and testing those specific differences on purpose: a data-volume test against a realistically sized dataset, a deliberate failure-mode test against sandboxed third parties, and load testing that runs against the real scaled topology instead of a single box standing in for it.

If your team has been burned by a "works in staging" incident before, the fix usually isn't more staging testing. It's testing the specific gap that staging can't see, which is a different exercise entirely, and one we build into mobile testing engagements alongside how we think about simulators versus real devices.