Create a basic test suite

You can use API resources to work with test suite entities. 

Overview

The tests entity is a composite, resource collection that represents all subtypes of tests: 

Tests entity subtypes.

Working with these test subtypes are described in this topic:

  • Manual tests, and their test steps

  • Gherkin tests, and their scripts

  • Test suites, and their manual and Gherkin tests

To work with automated tests, see Working with automated tests and pipelines.

The subtype attribute distinguishes between the test types in the test resource collection.

Work with the tests resource collection to: 

  • See or query all tests, regardless of subtype

  • Add steps to manual tests

  • Add scripts to Gherkin tests

Work with the individual resource collections (manual tests, Gherkin tests, and test suites) to focus only on those subtypes.

Back to top

About linking tests to suites

The tests_in_suite resource collection contains all test suites and their corresponding tests. It is used to link these types of resources.

Linking tests to test suites.

GET: Read test suites

Perform the following to read test suites.

Action API request
To see all tests, regardless of test subtype

GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/tests

To see only test suites, use one of the following

GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/tests?query="subtype EQ 'test_suite'"

GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/test_suites

To see the order of tests in a suite

GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/http://localhost:9090/api/shared_spaces/1001/workspaces/1002/test_suite_link_to_tests?fields=id,test_executable,order,test_id,test_name&order_by=order&query="!test EQ {null}"

Notes

  • The order field is only available for GET requests.

  • To use the order field, you must also specify order_by.

  • The order field is only relevant for the test_suite_link_to_test resource collection. This resource collection exists just to map tests and suites to each other.

Back to top

POST: Create a test suite

We create test suites using the test_suites resource collection.

To create a test suite: 

This example creates a test suite named MyNewTestSuite.

POST .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/test_suites
     {"data":[
       {
         "name":"MyNewTestSuite" 
       }    ]
     }

Back to top

PUT: Add tests to a test suite

We add tests to a test suite using the test_suite_link_to_test resource collection. The purpose of this resource collection is to map tests and suites to each other.

When adding tests to a test suite, existing tests are replaced. So make sure to add any existing tests to the suite at the same time as adding new ones.

To add tests to the test suite: 

This example shows how to use two POST calls to add a manual test (1013) and a Gherkin test (1014) to a test suite (1015).

POST .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/test_suite_link_to_test
     {"data":
      [
       {
            "test_suite":{"type":"test","id":"1015"},
            "test":{"type":"test","id":"1013"}
       }
      ]
     }
 
POST .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/test_suite_link_to_test
     {"data":
      [
       {
            "test_suite":{"type":"test","id":"1015"},
            "test":{"type":"test","id":"1014"}
       }
      ]
     }
 

Back to top