Inject realistic test data into your tests
Hand-maintained fixtures and factories rot the moment the schema moves, and copying a production dump into your test suite is a GDPR problem waiting to happen. The fix: one fixture that injects realistic, foreign-key-consistent data into your tests, data that actually looks real, not "Premium Widget 1" and lorem ipsum. It is dependency injection for your database. Works with pytest, Symfony/Doctrine, Laravel and Node.
Free tier, no card. Want to see the output before wiring anything up? Try the login-free sandbox: paste a schema, generate, look at the rows.
Why hand-written fixtures and factories don't scale
A handful of fixtures is fine. A real schema is not. Once you have dozens of tables, every factory has to know which parent rows exist, which foreign keys to satisfy, and which derived totals to keep in sync. You end up maintaining a second, worse copy of your schema in test code.
- Fixtures drift: add a NOT NULL column and every fixture that misses it starts failing.
- Factories multiply: one factory per table, plus all the wiring to point children at the right parents.
- Production dumps are a GDPR problem: real names, real emails, real card data sitting in your test suite.
- The data looks fake, so tests pass against rows no real query would ever return.
One fixture, a whole foreign-key-consistent database
A pytest fixture is just dependency injection: the test declares what it needs in its arguments and the framework provides it. So inject the whole database. SeedBase generates a realistic, foreign-key-consistent dataset from your schema, and a single fixture hands it to your test, either as a live database connection or as plain rows in memory.
- Every
customer_idpoints at a customer that exists, so the data loads with constraints on. - Realistic distributions and values, not "Premium Widget 1", so your assertions test against data that looks real.
- One fixture replaces the pile of per-table factories and the wiring between them.
Inject fixtures in pytest, Symfony, Laravel and Node
Use exactly the same generated dataset across stacks. Here is the per-framework wiring.
pytest (Python)
def test_pagination(seeded_database):
# a live connection to a DB full of realistic, FK-consistent data
rows = seeded_database.execute(
sqlalchemy.text("SELECT email FROM users LIMIT 5")
).fetchall()
assert all("@" in e for (e,) in rows)
Install with pip install "seedbase[database]". The seeded_database fixture loads a generation into a live database and hands you the connection. Prefer no database at all? The seeded_rows fixture returns {table: [rows]} as an in-memory dict, so you assert against the rows directly.
Symfony / Doctrine (PHP)
php bin/console doctrine:fixtures:load
Or inject the generated data straight into a test through the trait:
use Seedbase\Doctrine\InteractsWithSeedbase;
$this->seedFromSeedbase($connection);
Laravel (PHP)
php artisan db:seed --class="Seedbase\Laravel\SeedbaseSeeder"
Node
const tables = JSON.parse(await client.download(generationId, { format: "json" }));
You get {table: [rows]} as plain JSON, ready to feed into your test setup, an in-memory store, or a seeding script.
Deterministic and reproducible
Generation is seeded. The same seed produces the same data, every run. That keeps CI reproducible: the same fixture yields the same rows on every machine, so a green build stays green for the right reason. When a test fails, reuse the seed and you reproduce the exact dataset that broke it, instead of chasing a fixture that has since been hand-edited.
Free tier: generate, download, inject
Generation and JSON download are free to use. You do not need push-to-database or any paid feature to inject fixtures, because the data loads through your own database connection or as plain rows in memory. Generate once, download the JSON, and let your fixture wire it into the test setup.
Try it
There are runnable examples for each framework, so you can clone, run the test, and watch a real FK-consistent dataset get injected into the setup. Then point it at your own schema.
- Paste a schema and look at the rows in the login-free sandbox, no account needed.
- Drive generation from your editor with the VS Code extension or the JetBrains plugin.
- Read the docs for the pytest fixtures, the Doctrine trait and the Laravel seeder.
- Learn the basics on how to generate test data from a schema.
Stop hand-maintaining fixtures.
Generate a foreign-key-consistent dataset once and inject it into your pytest, Symfony, Laravel or Node tests. Free tier, no card.
Create a free accountMore: login-free sandbox · VS Code · JetBrains · Docs · home
Frequently asked questions
Is this free?
Yes. Generation and JSON download are part of the free tier, so you can pull a foreign-key-consistent dataset and load it into your tests through your own database connection at no cost. Pro adds Parquet export, direct database push and higher row limits, but you do not need any of that to inject fixtures into your tests.
How is this different from Faker or factory_boy?
Faker and factory_boy generate values one field at a time and you still wire up every relationship and factory by hand. SeedBase fills a whole foreign-key-consistent database from your schema, with realistic distributions, so a customer row that an order points at actually exists and the values look real instead of "Premium Widget 1" or lorem ipsum.
Does it need a real database?
It depends on the fixture you use. The seeded_database fixture loads the data into a live database and hands your test a connection, so yes for that one. The seeded_rows fixture returns the data as an in-memory dict of table to list of rows with no database at all, so no for that one.
Is the data deterministic?
Yes. Generation is seeded, so the same seed produces the same data every run. That makes CI reproducible: the same fixture yields the same rows, and a failing test can be reproduced exactly by reusing the seed.
Which frameworks are supported?
There are runnable examples for pytest in Python, Symfony with Doctrine and Laravel in PHP, and Node. Each one injects FK-consistent generated data into the test setup so you do not maintain fixtures or factories by hand.