Get a list of planned runs for manual tests, Gherkin tests, and test suites
The following flow demonstrates how to get a list of planned runs for manual tests, Gherkin tests, and tests suites.
Entity relationship diagram
We need to access the following entities for this flow, and understand the relationships between these entities.
The following shows the relations in the flow.
Flow
Let's create the REST API call step-by-step.
-
We request all runs in the workspace using the runs reference field.
GET ../api/shared_spaces/<space_id>/workspaces/<workspace_id>/runs
-
Let's now start building our query_clause.
This query has two sets of criteria: The test type, and the status. We separate each set with a semi-colon (;), which represents the And operator.
In this step, we are only interested in the runs for manual tests and Gherkin tests that have the planned status. This is an example of using a list node, using the logical_name field to check for a match.
GET ../api/shared_spaces/<space_id>/workspaces/<workspace_id>/runs?query="status EQ {logical_name EQ 'list_node.run_status.planned'}"
-
We want to access only the planned runs that are manual (manual tests, Gherkin tests, and test suites). We use the || to indicate an OR condition.
GET ../api/shared_spaces/<space_id>/workspaces/<workspace_id>/runs?query="status EQ {logical_name EQ 'list_node.run_status.planned'};test EQ {subtype EQ 'test_manual'||subtype EQ 'gherkin_test' || subtype EQ 'test_suite'}"
Note: This query might produce duplicates. Both the planned suite runs, and the planned manual and Gherkin runs inside the suite runs are displayed.
The complete REST API call for this flow is:
GET ../api/shared_spaces/<space_id>/workspaces/<workspace_id>/runs?query="status EQ {logical_name EQ 'list_node.run_status.planned'};test EQ {subtype EQ 'test_manual'||subtype EQ 'gherkin_test' || subtype EQ 'test_suite'}"
Javascript example
/** * Flow: Get a list of *planned* manual, suite, manual Gherkin runs based on a certain filter (runs related to a specific release) * @param requestor */ function getPlannedManualTests(requestor) { requestor.get('/runs?query="status EQ {logical_name EQ ^list_node.run_status.planned^};' + 'test EQ {subtype EQ ^test_manual^ || subtype EQ ^gherkin_test^ || subtype EQ ^test_suite^}"', function(error, message, runs) { console.info(runs); }); } exports.getPlannedManualTests = getPlannedManualTests;
See also: