API testing

Query with variables

Medium70 pts~25 min
  • GraphQL variables
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-query-with-variables

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

Objective

Pass arguments through GraphQL variables instead of string interpolation.

Your task

  1. 1POST BASE_URL + "/graphql" with query "query ($id: ID!) { user(id: $id) { id name email } }" and variables { "id": 3 }.
  2. 2Assert 200 with no errors.
  3. 3Assert data.user.name === "Grace Hopper" and email === "grace@acme.test".

Acceptance criteria

  • POST /graphql returns 200
  • Variables are sent
  • 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