API testing

Handle a null or missing field

Medium70 pts~25 min
  • Optional fields
  • Null safety
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-handle-a-null-or-missing-field

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

Objective

Write assertions that distinguish an absent optional field from a present one.

Your task

  1. 1GET BASE_URL + "/users/9999" → assert 404 and that error.fields is absent.
  2. 2POST BASE_URL + "/users" with {} → assert 400 and that error.fields is present with name and email keys.
  3. 3GET BASE_URL + "/users?q=zz-no-match" → assert items is an empty array (not null) and total === 0.

Acceptance criteria

  • A 404 from /users/{id}
  • A 400 from POST /users
  • At least 4 assertions pass

Fixtures

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

API testing · SDET · Working with JSON