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
59 practiced

Your team currently relies on brittle, hand-maintained local mock files standing in for real dependencies in tests, and you want to move to dynamic stubs backed by real contracts instead. Propose a migration plan: how do you get teams to adopt it, keep both approaches working side by side during the transition, and confirm the migration actually improved things rather than just moved the problem?

MediumTechnical
74 practiced

You consume webhooks from an external vendor that signs each payload with HMAC SHA-256 and includes a timestamp to guard against replay. Write a Postman pre-request script (or describe the equivalent code) that generates the correct signature header for a test webhook request, and describe the automated tests you'd write on the receiver side to verify signature validation, timestamp freshness, and replay protection.

MediumTechnical
63 practiced

Implement a reusable function that performs an HTTP GET with retry and exponential backoff for transient failures (server errors and network errors), with configurable attempt count and base delay. What do you need to be careful about if this function is used concurrently by many tests at once?

HardSystem Design
58 practiced

Design a consumer-driven contract testing rollout for an organization with dozens to hundreds of microservices owned by different teams. Cover how contracts are authored and versioned, how they are stored and published, what a provider verification pipeline looks like, and how you would handle a backward-incompatible change without breaking a deployment.

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.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.