API and Contract Testing Questions

Testing services and their interfaces directly. Covers REST and other API testing, request/response and schema validation, status and error handling, and contract testing between producers and consumers. Includes service-level and integration testing without a UI.

MediumTechnical
70 practiced

Write a script that compares two API contract manifests (each describing endpoints, HTTP methods, required parameters, and response fields) and reports the differences between them. What normalization would you need to do first, and how does the approach scale as the manifests grow large?

EasyTechnical
101 practiced

Explain consumer-driven contract testing: what problem it solves, how it prevents integration regressions between a service and its consumers, and what the consumer and provider sides are each responsible for in CI. What tooling typically supports it, and what pitfalls do teams commonly run into when adopting it?

HardTechnical
99 practiced

An API needs to keep serving multiple consumer versions while it evolves. Describe a test and rollout strategy that lets you change the API safely: how you would verify compatibility, what versioning policy you would use, and how you would eventually deprecate an old version without breaking consumers who haven't migrated yet.

MediumTechnical
70 practiced

You depend on a downstream API that is slow and occasionally unreliable, and you want to isolate your tests from it without your stub silently drifting away from what the real service actually does. How would you set up and maintain that stub so it stays a faithful stand-in for the real API's contract?

MediumTechnical
61 practiced

You're adding a new field to a public JSON API response that third-party clients already consume in production. Walk through a rollout plan that keeps existing clients working: what you'd validate before shipping, how you'd communicate the change, and how you'd monitor for client-side errors afterward.

Unlock Full Question Bank

Get access to all 9 API and Contract Testing interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.