# How to generate synthetic test data To generate synthetic test data without production records, describe your tables, how they join and what cases the application must handle. Ground builds the related tables you can inspect and export. Pin a checked export to use the same rows in local development and CI. [Read this guide on Ground](https://useground.dev/guides/synthetic-test-data) ## Write the request around your tests Name the tables and how they relate, the values that must agree (a total and its line items, a date and the dates after it), and the cases your code must handle: missing values, duplicates, rare statuses, boundary dates. Ground builds keys that point to real rows, computed columns that follow their inputs, and time series in order. 1. Check types and required fields against the consuming system. 2. Check dependent fields together, such as a city and its postal code. 3. Start with small row counts for integration tests; raise them for load tests. 4. Keep the downloaded tables with the test that uses them. ## Build a relational test database without production data The Acme Cloud fixture contains 83,061 rows across 8 linked tables. Load the pinned export into PostgreSQL and check foreign keys, invoice totals and four required cases. Use organizations as parents of subscriptions and invoices. Require every invoice to use its organization’s currency and every amount due to equal subtotal less credit. Ask for credited and overdue invoices so tests exercise both cases. - [Inspect the Acme Cloud tables](https://useground.dev/examples/acme-cloud) - [Load Acme Cloud in PostgreSQL CI](https://useground.dev/guides/seed-postgresql-database#acme-cloud-ci) > Generate synthetic SaaS billing and support data for a PostgreSQL test database. Include organizations, users, subscriptions, invoices, integrations, tools, usage events and tickets. Preserve their relationships. Include credited and overdue invoices, cancelled organizations and unresolved tickets. ## Adjust it in the editor The overview canvas shows every table and how they connect. Open a table to see its rows and each column's details. Ask Surveyor how many rows meet a condition, or to add rows or a column. To change the structure, add a table, column or relationship, or change row counts, then regenerate. ## Automate with the API Create a dataset with an idempotency key, poll its build and confirm the design if requested. Download the completed dataset by version, save its ZIP and checksum with your CI artifacts and replay those exact bytes when a test fails. - [Ground build and download API](https://useground.dev/docs/api) ## Common questions ### How do I get the same data again? Keep a versioned export and its checksum with your tests. Load that export on each run. ### Can I test related tables? Yes. Describe the tables and how they relate; keys in child tables point to rows that exist in their parents. ## Related guides - [What is synthetic data?](https://useground.dev/guides/what-is-synthetic-data): Synthetic data is made-up data with the structure and behavior of real data. Ground builds tabular datasets, often several related tables, from a plain-language request, or adds rows and columns to a table you upload. [Markdown](https://useground.dev/guides/what-is-synthetic-data/guide.md). - [How to evaluate synthetic data quality](https://useground.dev/guides/evaluate-synthetic-data-quality): Evaluate synthetic data at four levels: each value is valid, each row is consistent, combinations are plausible, and the dataset has the right mix of common and rare cases. Then measure it on the task you need it for. [Markdown](https://useground.dev/guides/evaluate-synthetic-data-quality/guide.md). - [Synthetic billing test data: test a $47.52 refund both ways](https://useground.dev/guides/synthetic-billing-test-data): In Ground Billing Replay, a previous refund attempt marked failed should be retried for $47.52. Change only that processor event from failed to pending and the expected action becomes wait. The refund request is still $47.52 in both snapshots. Test both or an agent that always retries can look correct. [Markdown](https://useground.dev/guides/synthetic-billing-test-data/guide.md). - [How to seed a PostgreSQL database with realistic data](https://useground.dev/guides/seed-postgresql-database): The Acme Cloud fixture contains 83,061 rows across 8 linked tables. Load the pinned export into PostgreSQL and check foreign keys, invoice totals and four required cases. [Markdown](https://useground.dev/guides/seed-postgresql-database/guide.md). - [How to choose a synthetic data generator](https://useground.dev/guides/synthetic-data-generator-options): Choose a synthetic data generator by what you can start with and what you need to repeat. A fixed schema favors a schema-driven generator. A written scenario favors a prompt-driven platform. Existing data calls for a fitted synthesizer if you need to preserve statistical patterns. [Markdown](https://useground.dev/guides/synthetic-data-generator-options/guide.md).