InterviewStack.io LogoInterviewStack.io

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.

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?

EasyTechnical
68 practiced

What does a solid test-data strategy for API and service tests actually look like in practice? Cover how you'd decide between generating data on the fly versus using fixed fixtures, when synthetic data is good enough versus when you need something closer to real production data, and how you keep tests from interfering with each other's data.

MediumTechnical
105 practiced

Write a test that consumes a paginated API and confirms every item is returned exactly once, with no duplicates and nothing missing. Handle the case where the API might use either page-number pagination or a next-page token.

EasyTechnical
65 practiced

You need to choose between Postman/Newman, REST-Assured, and a lightweight HTTP client with custom assertions for building an automated API test suite for a mixed-language team. What would push you toward each option, and how do they compare on maintainability, debugging, and how easily new team members can contribute?

EasyTechnical
55 practiced

An API might be protected by Basic Auth, an API key in a header, an OAuth 2.0 bearer token, or a client TLS certificate, depending on the endpoint. For each mechanism, how would you actually test that it's enforced correctly, and when would you mock the authentication step rather than performing a real end-to-end login flow in your test?

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.