---
title: "Test data and environments · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing/test-data-and-environments
updated: 2026-10-20
licence: "All rights reserved"
---

# Test data and environments

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

> Build test data in code, give each test its own, and test on an environment that matches production. Never copy personal data into tests.

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/test-data-and-environments`.

## Required

- [Give each test its own data](https://agentwranglers.se/playbook/testing/test-data-and-environments/isolated-test-data): Each test creates the data it needs and leaves nothing behind that another test could see.
- [Keep a staging copy with fake data](https://agentwranglers.se/playbook/testing/test-data-and-environments/production-like-staging): Keep a staging environment that runs the same build, settings and service versions as production, with fake data.

## Recommended

- [Build test data with factories](https://agentwranglers.se/playbook/testing/test-data-and-environments/data-factories): Create test data with small factory functions that fill sensible defaults. Each test sets only the fields it cares about.

- Previous: [End-to-end and browser tests](https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests)
- Next: [Flaky and slow tests](https://agentwranglers.se/playbook/testing/flaky-and-slow-tests)
- [All chapters](https://agentwranglers.se/playbook/testing)
