Skip to content

How it works

Integration tests spin up the real collaborator (or a faithful substitute), exercise the boundary, and assert on the observable state on both sides.

graph LR
  A[Test] --> B[Service A]
  B --> C[(Real DB<br/>or in-memory)]
  B --> D[Service B<br/>real or wiremock]
  C --> E[Assert on state]
  D --> E
  style B fill:#E8F5E9
  style C fill:#E8F5E9

Three patterns dominate. In-memory substitutes (SQLite, H2, fakeredis) trade fidelity for speed; good for validating query logic, bad for validating migration or vendor-specific behaviour. Wiremock services (WireMock, MSW) stub the HTTP layer; good for testing error paths and timeouts, bad for validating the real API's evolution. Test containers (Testcontainers, 2015) boot the real service in Docker; highest fidelity, highest cost, the modern default for teams that can afford it.