REST APIs

Applies to ReadyAPI 3.5, last modified on December 29, 2020

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 API Structure

Click the image to enlarge it.

Common tasks

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:

  1. Select several items.

  2. Right-click them and select Move REST <Items>.

  3. 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 –

  1. 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.

  2. ReadyAPI will display the Clone dialog, where you can specify the target project, test suite, and test case.

Renaming items

To rename an item:

  1. Right-click it in the Navigator panel and select Rename.

  2. 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:

  1. 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.

  2. 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.

Generating test suites

To create a test suite and test cases based on the service definition, do the following:

  1. Right-click the service and select Generate TestSuite.

  2. Use the Generate TestSuite dialog to configure how ReadyAPI should create test cases:

    Generate TestSuite dialog
    • TestSuite – Specifies the test suite to which the created test cases will be added.

    • Style – Specifies how ReadyAPI organizes the created test cases:

      • One TestCase for each Resource – ReadyAPI creates REST Request test steps for each method in the selected resources and organizes them into several test cases.

      • Single TestCase 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.

  3. Click OK.

ReadyAPI will create new test cases and name them based on the definition.

See Also

REST Service Interface
Working With APIs

Watch the video
 
Highlight search results