Get the environments for test results for specific releases

The following flow demonstrates how to get a list of test results for specific releases and environment categories. Examples of environment categories could be Application Under Test environments, browsers, or operating systems.

Entity relationship diagram

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

Entity Relationships in this flow Description of relationship Reference / relationship fields
Run Taxonomy_Item_Node

Each run is associated with 0 or more environments.

The Taxonomy_Item_Node represents the types of environments, including browsers or operating systems.

taxonomies
Release

Each run must be associated with a release.

release
Release Run Releases can be associated with runs. run

Back to top

Flow

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

  1. We start with a basic query that lists all runs in the workspace, 1002.

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

  2. We now modify the API Call to only return certain fields using the fields parameter. In this case, we only want to see taxonomy field values.

    GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/runs?fields=taxonomies

  3. Let's now start building our query_clause.

    This query has two sets of criteria: The release, and the environments (taxonomies). We will separate each set with a semicolon (;), which represents the And operator.

    In this step, we are only interested in the run results that are associated with releases that begin with "732.". This means releases 731 and lower will not be listed, and releases 733 and higher will not be listed. We use the release reference field using the name field to specify the release and the * wildcard symbol to accept multiple values.

    GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/runs?fields=taxonomies&query="release EQ {name EQ ^732.*^}"

  4. We want to access only those runs with associated with specific environments. One of the available lists in ALM Octane is taxonomies, and we want to compare the run's environment with the taxonomies list's value Chrome.

    GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/runs?fields=taxonomies&query="release EQ {name EQ ^732.*^};taxonomies EQ {name EQ ^Chrome^}"

The complete REST API call for this flow is: 

GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/runs?fields=taxonomies&query="release EQ {name EQ ^732.*^};taxonomies EQ {name EQ ^Chrome^}"

Back to top

Javascript example

/**
 * Flow: How to get test results in a release filtered by an environment {AUT Env, Browser, or OS}
 * @param requestor
 */
function getTestResultsFilteredByEnvironment(requestor) {
  // change for correct release name
  var releaseName = '732.';
  // environment taxonomy
  var browser = 'Chrome';

  requestor.get('/runs?fields=taxonomies&query="release EQ {name EQ ^' + releaseName + '^};' +
    'taxonomies EQ {name EQ ^' + browser + '^}"', function(error, message, runs) {
    console.info(runs);
  });
}

exports.getTestResultsFilteredByEnvironment = getTestResultsFilteredByEnvironment;

Back to top

See also: