Nobody's Real Here: Building Test Data That Doesn't Borrow the Nation's Records
Photo: NASA Johnson Space Center, Public domain, via Wikimedia Commons
The request arrives on a Thursday afternoon, usually by direct message: can someone dump the customer table into staging? It's a small ask. It's also the start of a chain that ends, sooner or later, in someone scrolling through a spreadsheet of real names and addresses wondering whether this counts as a personal data breach.
Production copies win because they are free, immediate and realistic. They are also a liability you can't inventory: the copy nobody remembers, the backup of the copy, the exported CSV on a laptop, the column added last quarter that the anonymisation script never learned about.
Synthetic data is the alternative, and it's better than most teams assume — provided you do the cataloguing work that makes it representative.
What "representative" actually means
You do not need a million rows to test a form. You need the rows that break things. In most UK systems that's a specific, finite, slightly eccentric list:
- Names with apostrophes, hyphens, double-barrelled surnames, single-letter forenames, and scripts that aren't Latin.
- Addresses with no building number, flats with letters rather than digits, properties named instead of numbered, and postcodes from the Channel Islands or the Isle of Man that are in the UK's postal system but not always in your shipping rules.
- Postcodes beginning BT, which behave differently in a surprising number of vendors' APIs.
- Phone numbers written as +44, 0044, 07…, with spaces, without spaces, and with the wrong number of digits.
- Dates: 29 February, the hour that runs twice in October, the hour that doesn't exist in March, and anything submitted at 23:59 on a bank holiday.
- Money: £0.01, negative amounts, refunds split across two currencies, and totals that don't survive a naive round-trip through a float.
- Text fields containing emoji, right-to-left characters, and the 4,000-character free-text box someone pasted their life story into.
None of that requires a real customer. All of it requires somebody to have written it down.
Keep an edge case register
Before you build a generator, build a list. A single file in the repository, edge-cases.md, with an entry per case: what it is, why it matters, which test covers it, and — the useful bit — a link to the incident or bug that taught you. The file grows every time something breaks in a way that traces back to a shape of data nobody thought of.
That register is the actual asset. Generators are replaceable; the knowledge of what your system finds difficult is not.
Generate, don't launder
A generator is code. Treat it like code: version it, review it, run it in CI, and seed it so the same seed produces the same dataset. That determinism matters — a failing test that only fails on some builds because the fixture generator rolled different dice is a week of somebody's life.
A practical shape:
- A small, hand-curated fixture set for unit tests, covering every entry in the register.
- A bulk generator for performance and integration environments, parameterised by volume and profile.
- Profiles that mimic distributions — a realistic spread of surname lengths, address formats and postcode areas — rather than uniform noise.
- A version number printed at start-up so anyone looking at an environment knows exactly which dataset it holds.
Make the generated data obviously fake where it can be. Reserved example domains, numbers in the 07700 900xxx range, and names that are clearly invented remove any chance of a colleague mistaking a synthetic record for a real person mid-demo.
The review before anyone exports a row
Here's where teams get into trouble: they assume anonymisation is a switch. It isn't. Removing names and postcodes from a table of transactions is not anonymisation — it's pseudonymisation, and pseudonymised data is still personal data under UK GDPR. Small populations make it worse: a record with an unusual job title, a rare condition and a specific town can identify one person even with every direct identifier stripped.
The ICO has been consistent on this for years. Anonymisation is a result, not a technique, and you should be able to demonstrate it. If you cannot, treat the data as personal and apply the full weight of the law to it.
So run a short, documented review before any export leaves a production environment:
- What categories of personal data are involved, if any?
- Is the dataset genuinely synthetic, or derived from real records?
- Could any individual be re-identified, alone or combined with another dataset?
- Where will it be stored and processed — including any vendor outside the UK?
- Who can access it, and what's the retention period?
- Who approved it, and when does the approval expire?
One page, one approver, a ticket number. Five minutes of paperwork that turns a six-week investigation into a five-minute answer.
The payoff is better tests, not just less risk
Teams that make this switch usually find the second-order benefit is the bigger one. Synthetic data that covers the edge cases catches the bugs that production copies never did — because a random sample of a million real customers contains almost none of the weird shapes that actually break a checkout. You get faster onboarding, environments that can be rebuilt from nothing, screenshots in slide decks that don't need blurring, and no quiet anxiety every time an auditor asks where the data lives.
Borrowing the nation's records is easy on day one. It's the day nine hundred that costs you.