Testing in production

Also called: test in production, production testing

Last updated:

Testing in production means checking a change on the servers, data and traffic it will actually run against, after it deploys. Staging can't reproduce those. A staging database is a few thousand rows of seed data, and the payment provider behind it is a sandbox that approves every test card, so some bugs wait for real users to find them. Testing in production makes that last check deliberate. The change goes to 1% of users first while someone watches the error rate, and switching it off takes seconds. Unit, integration and staging tests still run before any of this. You'll also see it written as test in production or production testing.

Is testing in production a bad idea?

Teams that test in production on purpose start a change on a small group, at a size someone chose in advance, with a way back that doesn't need a deploy. Some failures can't show up anywhere else. A query plan flips once a table passes 40 million rows, and a third-party API answers differently than its sandbox did. You will hit failures like those in production regardless, and a 1% rollout means the first people to hit them are a sliver of your traffic. If a bad change can corrupt data that switching off the code won't repair, a migration or a destructive write for example, rehearse it on a copy of production first.

How feature flags make it safe

A flag separates deploying code from exposing it. The new path ships to production switched off and sits beside the old one until a targeting rule serves it. Start with a rule that matches your own staff by email domain or an isStaff attribute, which is dogfooding, so the feature runs against production data while every customer keeps the current behavior. Next a percentage rollout hands it to 1% of users and then 5%, the opening step of a canary release. Flag configuration is kept per environment, so rules you set in production leave staging alone (the environments guide has the details). If error rates climb, the flag's kill switch moves everyone back to the old path as soon as the SDKs pick up the change, with no redeploy.

Common ways to test in production

Some dark launches run the new code on real requests and discard the result, which lets you compare its output and timing against the old path before any user sees it. A canary widens as its metrics hold. Targeted releases go to staff, then a beta cohort that opted in. An A/B test measures whether the change moves conversion or retention, and that takes real customers. Synthetic monitoring sits underneath all of them, running scripted journeys against production every few minutes and alerting on the first failure.

Safeguards to set up first

A test account that places an order will send a confirmation email and charge a card unless something stops it. Give test accounts an attribute your code checks before it calls payment, email or webhook providers, and filter them out of revenue reports. Build the dashboards before the first user sees the change and split them by variation, so the new path's errors can't hide inside the old path's totals. The flag's Analytics tab shows evaluations by variation, which confirms the cohort is the size you set. Then connect the kill switch to an alert. A flag trigger is a secret URL your monitoring tool calls to turn the flag off when the error rate crosses its threshold, so an alert at 3 a.m. switches the feature off before anyone is paged. Triggers come with the Team plan and above. Once the test ends, delete the test orders and accounts it created.

Want the full picture? Read the concept guide: Rollout strategies →

Try it in your own app

The Free plan covers 10 flags and 2 environments. No credit card, no demo call — sign up and ship.