In the Navigator panel, you can work with REST APIs to organize them for better accessibility and readability. REST APIs are organized in the following way:
REST service
A REST service is a top-level node of the REST services in the Navigator panel. Select it to see and modify resources, endpoints, and the service’s specification:
Resources
REST resource is an abstract entity that represents an object of a REST service that you can work with. Resources are listed as child nodes of a REST service:
Add resources
-
Click next to the REST API node and select Resource:
— or —
Right-click the API in the Navigator and select New Resource:
-
In the Add Resource dialog, specify the resource name and select which methods this resource should support. Click New Resource to specify additional resources to create:
-
Click Add.
Endpoints
The Endpoints page is the central place where you manage endpoints used in the REST API.
You can configure the following options:
Option | Description | ||||
---|---|---|---|---|---|
Endpoint |
The endpoint URL or destination.
|
||||
Environment |
An environment associated with the endpoint.
|
||||
Authorization Profile |
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 REST 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:
Specification
The Specification page of the REST Service editor shows the OpenAPI, Swagger or WADL definition of the service that is currently selected in the Navigator panel.
Note: | RAML and Swagger 1.x specs are converted to WADL internally. |
The content page lists available resources, methods, representations, and the specification. The specification will be updated when you add new resources and methods to the API.
Organize REST service
You can reorganize all the items in the API: requests, methods, resources and services.
Moving items
To move an item, copy it and delete the original item, or move several items and delete the ones you do not need:
-
Select several items.
-
Right-click them and select Move REST <Items>.
-
In the subsequent dialog, select a target destination from the drop-down list.
Copying items
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 –
-
Select one or multiple items in the Navigator panel. Right-click the selection and choose the Clone ... command from the context menu. Depending on the type of the selected items, the command text can be Clone Test Steps, Clone Test Case, or Clone Test Suite. If you selected items of different types, the context menu will contain a command for the last selected item type.
-
ReadyAPI will display the Clone dialog, where you can specify the target project, test suite, and test case.
Renaming items
To rename an item:
-
Right-click it in the Navigator panel and select Rename.
-
Enter a new item name.
Renaming items does not affect the API definition, it affects only item representation in ReadyAPI.
Renaming an item of a composite project will change the matching item's file name. |
Deleting items
To delete a item, select it in the Navigator panel and press Shift+Delete, then confirm you no longer need it.
Changing the item order
You can drag most items to the position you need in the Navigator panel. The item order does not affect your tests.
Note: Methods cannot be reordered.
Request specific tasks
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 Test Case.
– or –
Open the request editor and click Add to Test Case 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.
Adding requests as virtual responses
To add a request as a virtual response in a functional test:
-
Right-click the request in the Navigator panel and select Add as REST VirtResponse Step.
-
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.
ReadyAPI will add the latest response to the created REST VirtResponse test step.
Generate test suites
To create a test suite and test cases based on the service definition, do the following:
-
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.
-
-
Resources – Selects resources to generate test cases.
-
Create Load Test – Specifies whether ReadyAPI creates a load test for each created test case.
-
-
Click OK.
ReadyAPI will create new test cases and name them based on the definition.