Test Data Management: Production Copies, Masked Data and Synthetic Data
Test data · November 2026 · 9 min read
The three ways teams fill test environments, what each costs in realism, effort and UK GDPR risk, and a practical guide to choosing between them.
Test data management is the unglamorous question behind every test environment: where does the data come from, who is allowed to see it, and how do you keep it fresh? There are three answers in common use: copy production, mask production, or generate synthetic data. Each has a place. This guide sets out how they differ, what each costs, and how to choose, with UK data protection in mind throughout.
The three approaches
Most mature teams end up using a mix: synthetic data for development and CI, masked data for a small number of pre-production environments, and production itself only in production.
Production copies
Restoring last night's backup into staging is fast and gives perfect realism: every odd character in a surname, every address with no house number, every customer with three accounts.
It is also, under UK GDPR, processing personal data for a new purpose. You need a lawful basis for it, the test environment needs the same security as production, and every developer and contractor with access to staging now has access to your customers. If a test environment leaks, it is a data breach like any other, and test environments are typically less protected than live ones. The full argument, with the specific articles of UK GDPR involved, is in using real customer data in test environments.
Use it when: reproducing a production-only bug, under controls equivalent to production, for a limited time. Not as the default.
Masked data
Masking keeps the structure and volume of production but replaces identifying values: names swapped, emails rewritten to a safe domain, dates of birth shifted, addresses replaced.
The difficulty is that masking has to be complete and consistent to work:
- Complete. Personal data hides in free-text fields (order notes, support tickets, delivery instructions), in logs, in JSON blobs and in file attachments. Masking the obvious columns and missing these leaves real data behind.
- Consistent. If a customer's email is masked differently in two tables, joins break and tests fail for reasons that have nothing to do with the code. Deterministic masking (the same input always gives the same output) solves this, but deterministic functions can be reversed if the input space is small.
- Re-identification. A record with a real postcode, a real date of birth and a real gender is often unique even with the name removed. Masking that leaves quasi-identifiers intact is pseudonymisation, and pseudonymised data is still personal data under UK GDPR.
Addresses are a particular trap. Replacing a house number while keeping the real street and postcode leaves a record that points at a handful of real homes.
Use it when: you need production-shaped volumes and distributions, for performance testing or analytics, and you can afford to maintain the masking rules as the schema changes.
Synthetic data
Synthetic data is generated from rules or statistical models and never derived from a real record. Because no real person is behind any row, it can be shared freely: in CI logs, in bug reports, with an offshore team or in a public demo.
The trade-off is realism, and it is the part teams most often underinvest in. Generated data that is structurally wrong gives false confidence. A generator that emits postcodes Royal Mail never issued, or phone numbers in ranges that do not exist, will let validators pass in tests and fail in production. There is a worked example of exactly that in why Faker's UK postcodes fail validation.
Good synthetic data has three properties:
1. Structurally valid. Every value obeys the real format rules: postcode grammar, check digits on VAT numbers and IBANs, the Ofcom numbering plan for phone numbers. 2. Realistically distributed. The awkward cases appear at roughly the rate they do in reality: long names, flat numbers, addresses without a street number, Scottish and Northern Irish postcodes. 3. Safely fictional. Values look real but cannot reach a real person: phone numbers from Ofcom's ranges reserved for drama, addresses that are never live delivery points, email domains that cannot receive mail.
Use it when: developing, running automated tests, demoing, load testing, and anywhere the data will travel beyond your most trusted environment.
Choosing: a short decision guide
- Does the test need a real customer's specific record? Only for reproducing a production incident. Do it in a controlled environment and delete the copy afterwards.
- Does the test need production volumes or distributions? Masked data, or synthetic data generated to match production's statistics.
- Does the test need correct formats and edge cases? Synthetic data. This covers the large majority of functional and integration tests.
- Will the data leave your organisation, or be seen by people without production access? Synthetic data, without exception.
What a test data setup needs
Whichever mix you choose, the same capabilities come up:
- Provisioning on demand. A developer or a CI job should get a fresh, known data set in seconds, not raise a ticket. Generating from a seed makes this reproducible: the same seed gives the same data, so a failing test can be replayed exactly.
- Referential integrity. Customers, orders, addresses and payments must join up. Generate parent records first and derive children from them.
- Format coverage. A checklist of every regulated or check-digited field in your schema, and a test that each generated value passes its validator. For UK systems that list usually includes postcodes, phone numbers, VAT numbers, and sort codes, account numbers and IBANs.
- Refresh and teardown. Old test data accumulates and drifts from the schema. Rebuild environments from scratch on a schedule rather than patching them.
- An inventory. Know which environments hold real data, masked data or synthetic data. The answer to "where is our customer data?" should not have to include "probably in an old staging snapshot".
Generating UK test data with this site
This site is built for the synthetic side of that list, for UK formats specifically. The test data generator produces complete fictional records with names, addresses, postcodes and phone numbers in one go, and the REST API returns the same data as JSON for use in CI pipelines and seed scripts. Addresses sit on real postcode districts and post towns but are never live delivery points, and phone numbers come from ranges Ofcom reserves for fiction.
For how the generation works and how to judge any generator, including this one, see how UK address generators work.
More guides
- How to Check if a UK Address Is Real (and What “Valid” Actually Means)
- UK Bank Account Numbers: How Many Digits, How to Read One, and How to Check It
- The National Insurance Number Format Explained, with a Validator
- The NHS Number Format and Check Digit Explained
- UK Company Registration Numbers: Format and Prefixes Explained
- What Is a Post Town? How to Find Yours, and Why It Isn’t Always Your Town
- The UK Driving Licence Number Format Explained
- How Address Verification Software Works: PAF, UPRNs, Match Levels and What to Ask a Vendor
- Data Masking, Anonymisation and Pseudonymisation Under UK GDPR: What Each One Actually Means
- Validating UK Phone Numbers: Formats, Ofcom Ranges and the Mistakes Every Regex Makes
- Mocking a UK Address Lookup API in Your Tests
- Testing KYC and Identity Verification Flows Without Real Identities
- UK Sort Codes, Account Numbers, IBANs and SWIFT Codes for Test Data
- The UK VAT Number Format Explained, with a Check-Digit Validator
- The UK Postcode Format Explained: Areas, Districts, Sectors and Units
- Royal Mail Address Formatting: How to Lay Out a UK Address Correctly
- How UK Address Generators Work — and How to Tell a Good One
- Using Real Customer Data in Test Environments: The UK GDPR Problem
- Why Your Address Form Rejects Perfectly Valid UK Addresses
- The UK Telephone Numbering Plan, and the Numbers Reserved for Fiction
- Validating UK Postcodes in JavaScript, Python and SQL
- Where UK Address Data Comes From: PAF, ONSPD, OS Open Names and AddressBase
- Why Faker's UK Postcodes Fail Validation