Testing External APIs with WireMock
Integration-test code that calls external HTTP services by stubbing those services with WireMock instead of hitting the network.
The External Dependency Problem
Integration tests often touch real collaborators, but calling a live third-party API is slow, flaky, and may cost money. WireMock runs a local HTTP server you can program to mimic that API.
What WireMock Provides
WireMock lets you:
- Stub HTTP responses for specific requests
- Simulate delays, errors, and edge cases
- Verify that your code made the expected calls
All lessons in this course
- Unit vs. Integration Tests
- Setting Up Integration Tests
- Testing Database Interactions
- Testing External APIs with WireMock