How to generate realistic test (mock) data for development
Build a schema, generate thousands of rows of fictional names, IDs, emails and dates, and export to SQL, JSON or CSV — without exposing real customer data.
Published on
Why not use real data
Copying production data into a development environment is tempting, but it spreads customer information across machines, repositories and backups that are less protected, increasing the risk of a leak and your exposure under privacy regulations. Fictional data avoids the problem: it looks real to the application, but belongs to no one.
What makes good test data
- Realistic: accented names, emails, IDs with valid check digits, and real city names make validations and the interface behave the way they would in production.
- Varied: short and long text, small and large numbers, and some blank values to exercise how nulls are handled.
- At volume: pagination, filters and sorting only reveal problems with hundreds or thousands of rows.
- In the right format: dates in ISO 8601, monetary values, and identifiers in whatever shape the system expects.
Step by step in the generator
- Open the Mock Data generator and reproduce the columns of your table or JSON with Add field. Or start from a template instead.
- Choose the type closest to each column's real data, and rename it to match your model.
- Adjust the options via the gear icon (number range, format) and set a blank-value probability on columns that accept null.
- In the Generation card, choose the number of rows and the data language (next to the quantity).
- Click Generate data, check it on the Table tab, and download it in whatever format you need.
Relating fields to each other
Some types exist to keep the data consistent with itself:
- Sequence: increasing numbers (1, 2, 3...), ideal for predictable primary keys.
- Custom List: picks among values you define, like a status of
active,pendingandcancelled. - Formula: combines earlier fields, for example
{{first_name}}.{{last_name}}@company.com. - Reference Field: repeats another field's value, useful for duplicated columns or simple foreign keys.
Order matters
Formula and Reference Field can only see fields that appear before them in the list. Drag fields by their handle to reorder them.Which format to use
- SQL: INSERT statements to populate a development database.
- JSON: mock API responses and front-end test fixtures.
- CSV: importing into databases and spreadsheets (Excel, Google Sheets).
- JSON Lines: one object per line, common for bulk imports and data pipelines.
- TypeScript and JavaScript: export the
mockDataconstant (in TypeScript, with the type), ready to import into your tests. - YAML and XML: configuration fixtures and integrations that still use XML.
Want to test this against a real database?
TheINSERT statements generated here run as-is on Railway (partner link), which gives you $20 in credit to try a Postgres database for free.Best practices
- Export the schema as JSON (schema's options menu) and keep it in the project: anyone on the team can recreate the same structure.
- For automated tests that need a predictable result, use a file generated once and checked into version control, instead of generating new data on every run.
- Also run with "annoying" data: long names, empty fields, and values at the edges of the range. That's where bugs show up.
Frequently asked questions
Is the generated CPF valid?
It has correct check digits, so it passes format validation, but it's randomly generated and doesn't belong to a real person. Only use it in tests, never in real sign-ups or real-world situations.
Can I use the generated data in production?
That's not what it's for. The data is meant for development, testing and demos. It's fictional and random, with no relation to real people or companies.
How do I generate data in Portuguese?
The default language is English (US). To switch to Português (Brazil) — with Brazilian names, cities and addresses — use the Data language picker, in the Generation card, next to Quantity, right above the Generate data button.
How do I repeat the exact same dataset?
Each generation is random. For a fixed set, generate it once, download the file, and version it alongside your test code — or export the schema as JSON to recreate the structure later.