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

A service you depend on keeps shipping changes that break your integration with it, and the breakage is only caught after it reaches production. Propose both a technical and a process fix: what would you put in place so a breaking change is caught before it ships, who should own the tests that catch it, and how would you pilot the change and show it actually reduced regressions?

MediumTechnical
51 practiced

Your API tests run against multiple environments, dev, staging, and something closer to production-like. How would you manage the test data across them: how you seed it, keep tests isolated from each other, clean up afterward, and safely reuse anything derived from real production data?

EasyTechnical
59 practiced

For each of the HTTP methods GET, POST, PUT, PATCH, and DELETE: is it safe, is it idempotent, and what would you actually assert in an automated test to verify it behaves that way (not just that it returns a status code)?

EasyTechnical
53 practiced

An API supports returning either JSON or XML depending on content negotiation. How would you design automated tests that verify the API correctly honors the Content-Type and Accept headers, validates each format against its own schema, and handles an invalid or conflicting header combination?

MediumTechnical
58 practiced

An API supports multiple versions simultaneously, selected by a request header, and each version has its own response schema (with some fields deprecated in newer versions). Design a test harness that picks the right schema to validate against based on that version header, and explain how it stays maintainable as new versions ship.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.