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.
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 Overview page shows the existing queries and mutations.
To add or remove them, use the and buttons in the corresponding panel.
The Endpoints page lists endpoints added to the service.
You can assign endpoints from this list to GraphQL API requests, GraphQL Query, and GraphQL Mutation test steps. 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.
|Tip:||If you use different endpoints in different environments, it is better to modify endpoints in the Environments dialog, rather than specifying a new endpoint.|
To add an endpoint, click . To remove an endpoint, click .
Click Assign to set an endpoint to all the API’s requests, test steps, or both.
The Definition 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 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.
To add or remove queries, mutations, or an individual request, use and buttons in the respective editors.
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
To add a request to a functional test:
Right-click the request in the Navigator panel and select Add to TestCase.
– or –
Open the request editor and click Add to TestCase on the toolbar.
Select the test case to add the created test step to. You can also create a new test case or test suite and place the request there. Click OK.
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.