A fixture is everything a test assumes before it begins: the records in the database, the files on disk, the responses a mock will give. Tests are only repeatable if their fixtures are — a test that passes against yesterday's leftover data and fails on a clean environment is testing the leftovers.
Fixtures are created in setup and removed or reset in teardown, or each test runs against a fresh copy. They can be hand-written for the edge cases that matter, generated in bulk for volume and variety, or captured from a real system and scrubbed. Seeded generation gives both variety and repeatability.
That production data makes the best fixture. Copied data brings personal information into test environments, changes under you, and rarely contains the edge cases you need. Generated data with a fixed seed is safer and can be made to contain exactly the awkward cases.
POST /data/v1/generate returns deterministic fixture rows from a schema, and every sandbox here can be reset with POST /api/_reset so each test run starts from the same seed data; the sibling site fundata.dev generates larger fixtures as files.
All glossary terms · Testing techniques · All 39 mock REST APIs
Last updated