Writing automated tests that will run in a pre-production environment which has a high fidelity with the real production environment.
Thesis:
> The smaller the delta between a pre-production and the production environment, the higher the value of your pre-production automated test suite.
What constitutes the delta between two environments for a single application:
- Runtime application code — code itself will likely be the same but may be packaged differently (e.g. bundlers)
- Runtime code environment, i.e. local workstation vs build container (CodeBuild/GitHub Actions) vs Lambda
- Infrastructure services (e.g. real DynamoDB vs DynamoDB Local)
- Infrastructure configuration (e.g. your DynamoDB GSI definition, IAM roles/policies) (hopefully using [[Infrastructure-as-Code]])
- AWS account-level configuration (e.g. service policies, boundary permissions, soft limits)
- Pre-existing data (in databases, user pools, in-flight queue messages, etc)
- Temporal load patterns
## Rule of thumb
> Test as close to production as possible in terms of environment fidelity but as far away as possible in terms of time/stage.
## See also
- [[The inner and outer loops of software development workflow]]
- [[Shift left]]