GraphQL requests send queries or mutations. This topic describes how to work with them in ReadyAPI. To learn more about GraphQL services, see GraphQL Testing.
You specify a GraphQL query or mutation at the top panel of the Request tab:
In the Query Variables panel, you specify variables. To learn how to use variables in GraphQL, see the GraphQL documentation.
Use property expansions
You can use property expansions for both variables and query or mutation. To insert a property expansion:
-
Right-click within the editor where you want to add a property expansion and select Get Data:
-
In Get Data, select the needed property and click Add.
-
ReadyAPI inserts the required property expansion:
Change the method
GraphQL queries support the POST and GET methods. To change the method, select it from the drop-down list at the top:
Note: GraphQL mutations support only the POST method.
Validation
ReadyAPI can validate GraphQL requests and responses against a schema.
When you add a GraphQL schema to your project, ReadyAPI generates queries and mutations existing in the schema. All the requests under these queries and mutations, as well as test steps based on these requests, will have links to the schema, so ReadyAPI can validate if the specified query or mutation is correct:
ReadyAPI cannot validate requests under the manually added queries and mutations.
Validate requests
To validate a request, click Validate in the Request panel:
ReadyAPI goes through types and fields in a query and checks if the type has the specified fields.
Validate a response
GraphQL request properties | View ↓
GraphQL request properties define how ReadyAPI handles specific GraphQL requests.
Name | Description | ||
---|---|---|---|
Bind Address |
The network interface (an IP address), through which ReadyAPI will send the request. |
||
Description |
An arbitrary text describing the request. |
||
Dump File |
The path to the file where responses will be saved. If empty, responses are discarded. |
||
Encoding |
The type of request data encoding – for example, |
||
Endpoint |
The address of the GraphQL service (including the port number).
|
||
Follow Redirects |
If |
||
Max Size |
The maximum size of responses to be saved. |
||
Name |
The name of the request. |
||
SSL Keystore |
Specifies the file storing private keys that are used to authorize ReadyAPI to the server. Only works for HTTPS requests. |
||
Timeout |
The number of milliseconds to wait for the server response. If no data arrives within the specified time period, the request is considered to fail. If the value is 0 or is not specified, the wait time is infinite. |
Name | Description | ||
---|---|---|---|
Name |
The name of the request. |
||
Description |
An arbitrary text describing the request. |
||
Encoding |
The type of request data encoding – for example, |
||
Endpoint |
The address of the GraphQL service (including the port number).
|
||
Timeout |
The number of milliseconds to wait for the server response. If no data arrives within the specified time period, the request is considered to fail. If the value is 0 or is not specified, the wait time is infinite. |
||
Bind Address |
The network interface (an IP address), through which ReadyAPI will send the request. |
||
Follow Redirects |
If |
||
SSL Keystore |
Specifies the file storing private keys that are used to authorize ReadyAPI to the server. Only works for HTTPS requests. |
||
Dump File |
The path to the file where responses will be saved. If empty, responses are discarded. |
||
Max Size |
The maximum size of responses to be saved. |