Integration Testing with Spring
summary
Advocates shifting weight from heavy mocking to longer-scoped, transactional tests that rollback so each test leaves no DB state; shows H2 in-memory, standalone H2, and Dockerized MySQL (docker‑compose + failsafe) for DB realism; demonstrates p6spy to see SQL and detect stray commits from requires_new nested transactions; shows @MockBean for cutting external REST calls and WireMock (and recorder) to run real HTTP responses; uses Gherkin/Cucumber for many data-driven cases and explains cleanup strategies versus costly context restarts.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 2:43Why integration testing matters
- 8:21Testing with different databases
- 15:19Cleaning up test data
- 21:18Spring context management
- 25:12Transactional test isolation
- 33:50Inserting test data efficiently
- 40:13Cucumber for readable tests
- 44:28Mocking external services
- 47:14Dockerized dependencies
- 50:01Mocking HTTP endpoints
- 57:14WireMock for API testing
- 59:07Choosing the right database
