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:
|
Working with these test subtypes are described in this topic:
|
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.
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.
GET: Read test suites
Perform the following to read test suites.
Action | API request |
---|---|
To see all tests, regardless of test subtype |
|
To see only test suites, use one of the following |
|
To see the order of tests in a suite |
Notes:
|
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"
} ]
}
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"}
}
]
}