API testing

Validate a nested query response

Hard120 pts~45 min
  • GraphQL selection sets
  • Nested validation
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/api-testing-validate-a-nested-query-response

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

Objective

Query nested objects in one GraphQL request and validate the shape at every level.

Your task

  1. 1POST BASE_URL + "/graphql" with query ($id: ID!) { user(id: $id) { id name address { city country } } } and variables { "id": 1 }.
  2. 2Assert no errors.
  3. 3Assert data.user.address.city === "London" and country === "UK".
  4. 4Assert no fields you did not select (e.g. email) are present.

Acceptance criteria

  • POST /graphql returns 200
  • At least 3 assertions pass

Fixtures

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

API testing · API Testing · GraphQL