smallbox

Integration testing

Build the database through the app. Copy it for tests.

We do not fill the database with hand-written fake rows. We run simulated users, actions, jobs, and mocked time through the same Facade methods the application uses. That creates a baseline database the system itself produced. Each test gets a fresh copy of that baseline, runs one action, checks the result, and deletes the copy.

1 · Seed

Seed through → Facade

DTOfilled with seed data
Facadeproduction entry point
BusinessServicerules run
Repositorywrites state
DBdatabase filled by application code

DTO filled with seed data

The seed does not bypass the system. It enters through the Facade, so the baseline is created by application code instead of hand-written rows. Broken rules surface while the baseline is being built.

2 · Simulate

Simulate useful states

Mocked time moves forward
  1. Day 1
  2. Day 7
  3. Day 22
  4. Day 45
  • User A·onboarded
  • User B·first trade
  • User C·failed payment
  • User D·mid-flow
  • User E·edge case

The generator advances time and runs normal flows until useful testing states exist. Then the database is frozen as one reusable baseline.

3 · Test

Copy, test, delete

User A@ onboarded
CopyRunAssertDelete
Cloning baseline into a fresh DBTests run: 0

Each test starts from a clean copy of the baseline. It restores one named state, runs one action through the Facade, checks the database or DTO result, then throws the copy away.