
Mocking vs Contract Testing

Creator of WireMock: Building a Successful OSS and The Art of API Mocking - Tom Akehurst
Topic 5 of 11
Published Mar 24, 2025 · Clip 22:24–27:27 (5:03)
Tom explains that API mocking and contract testing are adjacent: mocking is integral to consumer-driven contract testing (WireMock is used in Spring Cloud Contract). He addresses skepticism that mocks can't be trusted, advocating a risk-based segmentation of tests: assume contracts are correct for most tests, then use a smaller set of contract/integration tests to validate assumptions. Mocks also flatten the economics of testing edge cases versus happy paths.