Testcontainers and WireMock
Learn Testcontainers and WireMock (Phase 13 · Microservices Testing (Core), Microservices) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Testcontainers • Testcontainers starts real services (PostgreSQL, MySQL, Kafka, Redis, RabbitMQ, Keycloak, LocalStack, Elasticsearch) in Docker containers for tests: production-like , disposable, no shared test environment. With Spring Boot 3.1+ use @ServiceConnection (auto-wires the datasource/Kafka properties) or @DynamicPropertySource . Share containers across tests (singleton/static or reusable) to keep the suite fast; run Flyway migrations on the real DB. • Docker must be available in CI (GitHub Actions ubuntu runners have it; Jenkins agents need a Docker socket or Testcontainers Cloud).