TST-26Required
Keep a staging environment with generated data
Keep a staging environment that runs the same build, settings and service versions as production. Fill it with generated data, never with a plain copy of production's data.
How to do it
Deploy every change to staging first with the same script as production. Use the same database engine, runtime and web server versions. Give staging its own keys and accounts, so nothing in it can touch customers. Fill it with generated data, or a masked copy when you need production's shape. Staging copies production's setup, not its customers. A static site with no database or keys needs only a preview deploy of the same build. See also build every environment from the same code.
How to check
Staging and production report the same build and runtime versions, such as on a version endpoint or in the deploy log. Staging uses none of production's databases or keys, and its user records hold only generated addresses, such as @example.com.
Sources
Related rules
- TST-23 Keep a trace of every failed browser test in Testing
- DAT-32 Keep personal data out of test copies in Data and databases
- INF-11 Build every environment from the same code in Infrastructure and environments
- TST-58 Make the test setup refuse production in Testing
- TST-46 Compare environments with the same release in Testing
- SEC-2 Test on a copy of the system in Adversarial testing
- SEC-3 Do no harm in Adversarial testing
- DOC-23 Use only made-up data in docs in Documentation
- TDD-2 Work from read-only access and delete copies afterwards in Technical due diligence
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/testing/test-data-and-environments/production-like-staging">Agent Wranglers testing playbook</a>. In code you write, add a comment next to it with the same link.