When you add a GraphQL API, ReadyAPI shows its parts in the Navigator panel:
This section describes how you can manage GraphQL APIs in ReadyAPI. To learn basic information on testing GraphQL services in ReadyAPI, see GraphQL Testing.
A GraphQL service is a top-level node of the GraphQL services in the Navigator panel. Select it to see and modify added queries, mutations, endpoints, and the service’s schema:
The Endpoints page is the central place where you manage endpoints used in the GraphQL API.
You can configure the following options:
The endpoint URL or destination.
An environment associated with the endpoint.
An authorization profile used to access the endpoint.
Work with environments
When you do not use an environment, you can assign any endpoint that is not associated with an environment to GraphQL API requests. In this case, the request or test step will send a request to the specified endpoint. Once you change the endpoint, it will be updated in all the requests and test steps using it:
When you set an environment, all the API requests and test steps will use the endpoint associated with this environment:
The Specification page shows the GraphQL schema: defined types, queries and mutations. This information helps you build queries and mutations.
To quickly navigate through the schema, use the navigation tree on the left.
GraphQL queries and mutations
Queries and mutations are grouped in the Navigator under the nodes with the same names: Queries and Mutations.
For each query and mutation, you create one or more requests, each of them may fetch a different set of data from the service or specify different parameters for mutations.
Add query or mutation
To add a query or a mutation:
Add GraphQL request
To add a GraphQL request:
To learn more about GraphQL requests, see GraphQL Requests.
Organizing GraphQL services
You can reorganize elements of the GraphQL API: queries, mutations, and requests.
To rename an item:
Select it in the Navigator panel and press F2.
– or –
Right-click it in the Navigator panel and select Rename.
Renaming items does not affect the API definition, it affects only the item representation in ReadyAPI.
|Renaming the service in a composite project will change the matching folder name.
To delete an item:
Select it in the Navigator panel and press Shift+Delete.
– or –
Right-click the item in the Navigator and select Delete.
Adding requests to functional tests
In ReadyAPI terms, cloning means creating an exact copy of an item. To clone test steps, test cases, or test suites:
In the Navigator panel, press Ctrl and drag the desired test step, case, or suite to a new location.
– or –
Right-click the request and select Clone Request.
Generate test suites
To create a test suite and test cases based on the service definition, do the following:
Click next to the service and select Generate Test Suite from the flyout menu.
Right-click the service and select Generate Test Suite.
Use the Generate Test Suite dialog to configure how ReadyAPI should create test cases:
Test Suite – Specifies the test suite to which the created test cases will be added.
Style – Specifies how ReadyAPI organizes the created test cases:
One test case for each resource – ReadyAPI creates REST Request test steps for each method in the selected resources and organizes them into several test cases.
Single test case with one request for each method – ReadyAPI creates REST Request test steps for each method in the selected resources and organizes them into a single test case.
Queries – Selects queries to generate test cases.
Mutations – Selects mutations to generate test cases.
Create Load Test – Specifies whether ReadyAPI creates a load test for each created test case.
ReadyAPI will create new test cases and name them based on the definition.