Ctrl K
QA · Mid-level · Coding

There's an endpoint POST /api/users: it accepts JSON with the fields email and name, and on success returns status 201 and the created user with the fields id, email, name and createdAt. Write automated tests for this endpoint: a positive scenario that checks the response schema, and a couple of negative ones.

~15 min by voice

How to approach it

The interviewer wants to see whether you can write API tests that actually catch bugs and pass reliably on repeated runs. It's important to clarify the contract before coding, check the status, the schema and the data, cover meaningful negative cases, and not leave junk on the environment.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsYour service is integrated with an external payment provider, and on the test environment it's either unavailable or takes a minute to respond. How would you test this integration? Mid-levelIn a system of twenty microservices, the end-to-end tests take a long time and fail constantly. How would you apply contract testing, and what won't it cover? SeniorYou've been given a new REST endpoint for creating a user. What will you test? JuniorHow would you test a REST endpoint for creating an order, POST /orders? What would you check besides a successful response? Mid-levelHow would you test a payment creation API for idempotency and concurrent requests? Senior

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~15 min