The power of mocking APIs
summary
A simple weather app is replaced with a Wiremock standalone server on localhost:8080 that returns stubbed responses so the UI can be tested in isolation. Examples: swapped in a thunderstorm JSON, served an invalid JSON that produced NaN and missing sunrise/sunset, injected a 9000 ms fixed delay, and returned a 500 error that crashed the UI. Setup uses a Wiremock dependency and local stub files; source code and mocks are available on GitHub and the approach proves effective for finding bugs early.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 2:47Weather check app
- 8:12Breaking dependencies
- 14:25Testing hard scenarios
- 17:59Early invalid response detection
- 20:50Slow/unresponsive APIs
- 22:58Simulating API errors
- 24:49APIs not ready
- 26:37Mocking beyond web
- 28:02Mocking versus end-to-end testing
- 28:43Pros and cons
- 30:11Summary
related talks
42mFree Your Frontend Client from Backend Cage
32mWiremock: because your microservice needs a buddy when you're testing
13mSpeed up writing tests with Wiremock Spring Boot
41mAdvanced HTTP Mocking with
25mMock to start
36mFake It While You Make It
21mRevolutionizing API Design: The Power of Mock-Based Prototyping
25mDevelop in parallel and ship earlier with OpenAPI and mocking
