Use the GraphQL Request test step to send GraphQL requests without adding a GraphQL API to your project.
Tip
If you have a GraphQL schema, we recommend that you add a GraphQL API to your project and use GraphQL Query and GraphQL Mutation test steps.
To modify the settings of the test step, use its editor:
![]() |
Displays the GraphQL query. You write queries by using the general GraphQL syntax. In the Query Variables panel, you specify variables used in the query in the JSON format (see the example below). TipBoth fields in the Request panel support property expansions. | |
Displays the header and body of the request as text. ImportantReadyAPI populates this tab after you run the test step. | |
Use this panel to specify the authorization type and authorization parameters for your request. | |
Use this panel to create and modify custom header fields. |
You can also change the test step behavior by using the step properties on the GraphQL Request Properties and Custom GraphQL Request Test Step Properties panels in the Navigator.
Properties
Name | Description |
---|---|
Name | The test step’s name. |
Description | Text that describes the test step. |
Encoding | The encoding of the request data in the |
Timeout | The number of milliseconds to wait for a server response. If there is no response during this period, the test step fails. 0 (zero) or no value means an infinite waiting time. |
Bind Address | The network interface (IP address) through which ReadyAPI will send the request. |
Follow Redirects | Enables handling of redirects. Specify |
Follow 302 Redirect with GET | If set to ImportantWorks only when the |
SSL Keystore | The file that stores the private keys used to authorize ReadyAPI when connecting to the server. This works for HTTPS requests only. |
Dump File | Specifies the fully qualified name of the file to which you want to save the server response. Leave this property empty if you don't want to save the response to a file. |
Max Size | Specifies the maximum number of response bytes ReadyAPI shows in the editor to save memory. To show the entire response, specify 0. ImportantThe specified assertions may fail if there is not enough data for verification. |
Discard Response | When this option in set to |
Custom GraphQL Request Test Step Properties
The values on the Custom GraphQL Request Test Step Properties tab are available to other test steps in your project. For instance, you can verify these property values with the Assertion test step, or you can check them and change the execution flow with the Conditional GoTo test step.
You can load the values of custom properties from a file or save them to a file. To learn more, see About Properties.
This tab contains the following properties that provide access to the request and response data:
Name | Description |
---|---|
Response | The response data without headers. You can see the same content in the response's JSON panel. To get the response data without headers, use the |
RawRequest | The body content of the sent request. You can see the same content in the request's Raw panel. Property expansions are converted to the expected values. To get data with unconverted property expansions, use the |
ResponseAsXml | The response data as an XML DOM document (if possible). |
RawResponse | The response data with headers. You can see the same content in the Raw panel of the response editor. To get the response data without headers, use the |
The test step toolbar contains commands that allow you to modify a test step, change the base REST request or customize the appearance of the test step editor.
![]() |
To add an assertion, use the Add Assertion button on the Request toolbar.
To modify assertions, use the Assertion panel.
The following assertions are available for the GraphQL test step:
Name | Description |
---|---|
Property Content: | |
Verifies that the response contains the specified string. | |
Verifies that the value of a property is equal to the specified value. | |
Checks whether the binary response is equal to a file. | |
Counts the occurrences of the specified element. | |
Checks whether the specified element exists. | |
Checks whether the specified element matches the expected value. | |
Checks whether the specified element matches a regular expression. | |
Verifies that the message contains the expected contents. | |
Verifies that the response does not contain the specified value. | |
Verifies the message content and metadata such as headers and the status code. | |
Compliance, Status and Standards | |
Checks whether the response contains the expected value of an HTTP header. | |
Verifies that the response contains the specified HTTP header. | |
Checks whether the HTTP status code is not in the specified list. | |
Verifies that the request and response comply with the specified JSON schema. | |
Checks whether the HTTP status code is in the specified list. | |
Script | |
Executes a script to perform a custom assertion. | |
SLA | |
Checks whether the response was returned during the specified timeout. | |
Security | |
Verifies that the response does not contain any sensitive information. |
While the test step editor is open, brief information on the sent requests is listed on the Log tab. If the test step is run as part of a test case, you can see a more detailed log in the Transaction Log panel.
Below, you can find information on common tasks you can perform with the GraphQL Request test step.
To specify a query with variables:
Declare a variable the query will accept:
query getCustomer($customer: String) { customer (name: $customer) { email } }
In the Query Variables panel, specify the values of the variables in the JSON format:
{ "customer": "John Smith" }
When you send a request, ReadyAPI will send the variables along with the query, and a GraphQL service will use the variable values in the query:
![]() |
Mutation is a query that modifies data on the server. In ReadyAPI, you specify mutations using the regular GraphQL syntax. For example:
mutation {
editCustomer (name: "John Smith", email: "john.smith@example.com") {
name
email
}
}
![]() |