API contract tests: how can an endpoint be broken while returning HTTP 200?
Test response schemas, authorization, compatibility and client expectations rather than relying on successful status codes.
HTTP 200 is not proof of correct behavior
An endpoint can return 200 while associating data with the wrong property ID, serializing numbers as strings or removing fields an existing client requires. A contract test checks both response shape and agreed behavior. Required field types, null semantics, ordering, pagination and error codes should be explicit.
Cover negative and boundary cases
Happy-path tests alone are insufficient. Unknown identifiers, empty results, unusually long inputs, unauthenticated 401 responses, authorization 403 responses and rate-limit 429 responses need separate checks. Parameter binding and safe serialization deserve independent tests. Where APIs map external IDs to internal objects, verify that a source identity cannot silently cross-link unrelated records.
Coordinate schema changes with rollout
An older mobile application may remain online after the server deployment. Options include preserving old fields temporarily, versioned responses or a compatibility adapter. Deleting fields without testing consumers can break real clients. Silent schema changes that distort interpretation may be harder to detect than explicit server errors.
Production smoke tests must cover dependencies
After deploying, exercise a real list response, an authenticated endpoint, a detail page and read-after-write behavior, not just a health URL. Mobile and desktop clients may make requests with different timing, exposing races and caching issues. Production test data needs an explicit isolation and cleanup policy before it creates persistent business records.
Comments
0 real commentsNo real reader comments yet.
✎ Write a comment