API testing

Validate the user API contract

Medium70 pts~25 min
  • Contract testing
  • Error envelope
Practice app · Acme REST API

A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.

BASE_URL
/api/practice
Console app
/lab/sdet-validate-the-user-api-contract

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Cover the user API contract end to end: success shape, creation semantics and the error envelope.

Your task

  1. 1GET BASE_URL + "/users/1" and validate the User schema.
  2. 2POST BASE_URL + "/users" with a unique email → assert 201, Location header and the same User schema.
  3. 3GET BASE_URL + "/users/9999" → assert 404 with { error: { code: "USER_NOT_FOUND", message } }.

Acceptance criteria

  • GET /users/1 returns 200
  • POST /users returns 201
  • GET /users/{id} returns 404
  • Schema validation is used
  • At least 3 assertions pass

Constraints

  • Use a unique email per run, e.g. qa.<timestamp>@example.test — emails must not already exist (409 EMAIL_TAKEN).

Fixtures

apiKey
tqa_live_key_123
basicUser
admin
basicPassword
secret
username
qa@target.dev
password
Test@123

API testing · SDET · Schema & contracts