Mock Me If You Can: Using Mocks in Container Applications for Integration Testing
summary
A practical demo shows using Wiremock sidecar containers (Docker image copied into a pod) to run narrow integration tests for a small "issues-handler" app that calls GitHub; the recorder captures exactly two stub mappings for repo + issues, proxy/snapshot mode generates full mappings from live APIs, and templating, scenarios and fault injection simulate stateful flows and failures. CI steps build app and mock images together, run RestAssured tests via Gradle against localhost:9080 in Kubernetes, producing fast repeatable results. narrow integration testing recording/proxy snapshotting
AI-written summary · about
chapters (18)
- 0:00Introduction
- 1:02Testing pyramid
- 4:11Narrow integration testing
- 6:14WireMock for API mocking
- 8:01Mocks with JSON mappings
- 9:25Recording mocks from APIs
- 11:54Mocks from OpenAPI specs
- 12:17Request matching and templating
- 14:25Stateful API interactions
- 15:49Faults and delays in mocks
- 17:14Managing stale mocks
- 18:16Mocks in CI/CD
- 20:44RestAssured integration tests
- 21:53Demo: mocking GitHub API
- 26:37Proxying and snapshotting
- 27:44Integration tests with mocks
- 29:08Key takeaways
- 30:37Q&A
related talks
44mFake It until You Make It! API Integration Testing with Containers & WireMock
50mContinuous API Mocking and Testing with Microcks, Keptn, and Testkube
51mFramework agnostic REST api testing
01h 03mMocks vs Testcontainers
22mStrategies for Generating Dynamic, Realistic Mocks for Messaging APIs
45mStop Using Mocks (for a while)
26mSimplify Your Dev Life with Testcontainers
38mDoublers in Tests. Wiremock vs Mockito
