Stale API Mocks Can Hide Breaking Contract Changes for Months
A developer discovered that their test suite had been passing for months despite the real API's response structure having changed, because all tests ran against an outdated mock. The backend team had split the name field into firstName and lastName and added a status field, but the mock was never updated to reflect these changes. Since no tests were run against the live endpoint, the suite remained green while silently testing a contract that no longer existed. To fix this, the developer introduced a separate set of contract tests that run on a schedule against the real API, checking that expected fields and types are still present. The key takeaway is that mocks require ongoing maintenance tied to the real API contract, rather than being written once and trusted indefinitely.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in