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.

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

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?

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?

HardTechnical
67 practiced

Your product integrates with a third-party API that has strict rate limits and charges per call, so you can't freely hit it from your test suite. Describe a testing strategy that gives you real confidence in the integration without incurring high cost or violating the provider's limits.

MediumTechnical
74 practiced

Walk through how a consumer-driven contract testing tool like Pact actually operates end to end: how the consumer test generates a contract, how that contract gets published and versioned, and how the provider verifies against it in its own CI. Where does this approach break down, and how would you introduce it to a team that has never used it before?

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.