API testing

Assert a GraphQL error response

Medium70 pts~25 min
  • GraphQL errors
  • Negative testing
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-assert-a-graphql-error-response

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

Objective

Send an invalid query and assert the GraphQL error format.

Your task

  1. 1POST BASE_URL + "/graphql" with { "query": "{ users { id password } }" } (password does not exist).
  2. 2Assert HTTP status 200.
  3. 3Assert errors is a non-empty array and errors[0].message mentions password.

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