GraphQL API testing and validation of data and errors
Get help with your first test →
A GraphQL response arrived, but the expected object is missing. Inspect data and errors separately.
Set the query
Choose the GraphQL body type in the HTTP request editor. Supply query, variables and, if needed, operationName. The example requires your test endpoint to expose an order field; it is not a request to an available public service.
query Order($id: ID!) { order(id: $id) { id status total } }Supply variables
Paste this JSON into variables and verify endpoint, authentication and content type. Checkcraft creates a body with query and variables, adding a nonempty operationName. Valid JSON variables may still violate server schema types.
{"id":"ORD-1042"}Validate data and errors
Assert the relevant fields in data.order and handle errors explicitly. Partial data and errors may coexist. Define an expected status and no-error condition for a passing case, then test an unknown ID separately.
Limit the conclusion
Checking returned JSON is not an audit of the entire GraphQL schema. This workflow covers HTTP request and response testing. Subscriptions, federation and performance require separate workflows. Start with one operation and a deliberately failing result.
References
Start with the linked example and compare its result with your own test requirement.