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.
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
- 1GET BASE_URL + "/users/9999" → assert 404 and that error.fields is absent.
- 2POST BASE_URL + "/users" with {} → assert 400 and that error.fields is present with name and email keys.
- 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