elefcode
← All guides

Dev Basics · 4 min read

Generating Realistic Test Data (Without Using Real People)

Good test data makes bugs visible: long names that break layouts, accented characters, empty fields, and edge-case dates. Copying real customer data to get that variety is tempting — and a common source of data leaks.

Try it yourself with the related tool.

Generate fake data →

Advertisement

Why not use production data?

Development laptops, staging databases, and CI logs are far less protected than production. Real names, emails, and addresses in those places are a privacy risk and, under GDPR and similar laws, may be a compliance problem. Generated data gives you volume and variety with none of that risk.

Make it realistic and nasty

Realistic data catches realistic bugs: names with apostrophes and hyphens, non-Latin scripts, emoji, very long strings, missing optional fields, and dates around leap years and time-zone changes. Mix ordinary records with a deliberate share of awkward ones.

Safe domains and numbers

Use addresses at example.com, example.org, or the .test domain, which are reserved and will never deliver email. Use published test card numbers rather than anything resembling a real card. This prevents a test run from accidentally emailing or charging a real person.

Reproducibility

Seed your generator so the same seed always produces the same data. Tests then fail consistently instead of randomly, and a bug found with seed 42 can be reproduced by anyone on the team.

Related guides