Integration Test Prompt — the Boundary Is the Subject
Real database, real services, real transactions — integration tests that verify round-trips and rollback, not mocked theater.
Overview
Integration tests fail their purpose when they mock the very boundary they exist to test. This setup generates the integration contract for a CRUD service against its real database layer: data round-trips verified end to end, transaction behavior tested explicitly (commits commit, rollbacks leave no debris), each test owning its setup and teardown — with failure scenarios that only exist at boundaries: constraint violations surfacing as the right errors, downstream timeouts mid-operation, partial failure leaving clean state, concurrent access to the same data.
Workflow
1
Point it at the boundary
The service plus its real database — the contract treats the seam as the subject, not an inconvenience.
2
Trust the transaction scenarios
Half-failed operations and rollback verification are the tests that pay for themselves in one incident.
3
Keep tests self-owning
Each test sets up and tears down its own data — the rule that keeps integration suites parallel-safe.
Why This Works
Boundary-as-subject framing stops the mock-everything reflex
Transaction scenarios test the failure modes mocked tests structurally cannot see
Setup/teardown ownership keeps the suite honest as it grows
Best for
Data-access layers whose unit tests mock away the truth
Services where transaction boundaries carry the correctness
Teams burned by "works with mocks, fails with Postgres"
Not for
Pure business logic — unit strategy with mocks is faster and sharper there
Full user journeys through the UI — that's the E2E Test Prompt
Use cases
Testing CRUD services against the real database layer
Verifying rollback actually rolls back — before production proves it doesn't
Catching constraint violations that surface as 500s instead of 400s
Tip: Save time by exploring related resources and tools that integrate with this workflow.
Found a bug, have a suggestion, or want to report something confusing? Send a short note.
Cookie preferences
NewPrompt uses optional Google Analytics cookies to understand site usage and improve the tools.
The site works normally if you decline analytics cookies.
Read more in our Cookie Policy.