Get tagged automated tests associated with an application module

The following flow demonstrates how to get a list of automated tests that are associated with an application module (product area) and have a specific tag.

Entity relationship diagram

We need to access the following entities for this flow, and understand the relationships between these entities.

Entity relationship diagram for the Tests and Automated Tests entities.

The following shows the relations in the flow.

Entity Relationships in this flow Description of relationship Reference / relationship fields
Tests None The test entity represents types of tests, including manual, Gherkin, and automated. subtype
Automated Test Test

The automated test is a subtype of tests.

There is no field that relates back to the aggregate resource collection, tests.

None
Automated Test Product Area (Application Module) An automated test can be associated with 0 or more application modules (product areas). product_areas
Automated Test User Tags An automated test can be associated with 0 or more user-defined tags. user_tags

Back to top

Flow

Let's create the REST API calls step-by-step.

  1. We can start by listing all the automated tests in the workspace.

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

  2. Let's build our query_clause.

    This query has two sets of criteria: The user tags and the application modules(product areas). We will separate each set with a semi-colon (;), which represents the And operator.

    In this step, we are only interested in automated tests that have a user-defined tag called security. We use the name field of the tag to check for a match.

    GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/automated_tests?query="user_tags EQ {name EQ ^security^}"

  3. We also want to query for application modules (product areas) that relate to messaging. We use the asterisk (*) wildcard to indicate that we only want to list those automated tests (with a security tag) in all application modules that start with Messag. This includes application modules that start with message, messaging, and messaged.

    GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/automated_tests?query="user_tags EQ {name EQ ^security^};product_areas EQ {name EQ ^Messag*^}"

The complete REST API call for this part of the flow is: 

GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/automated_tests?query="user_tags EQ {name EQ ^security^};product_areas EQ {name EQ ^Messag*^}"

Back to top

See also: