Get failed runs by checking the run history

This scenario demonstrates how to use a non-standard API resource to look at the history of test runs. We will examine two flows:

Note: runs are a technical preview. Until made public, send an HPECLIENTTYPE header with the value: HPE_REST_API_TECH_PREVIEW in your requests.

Areas: Automated test runs, Run history, CI/CD integration

Entity relationship diagrams

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

To check previous runs by entering a run ID: 

To check previous runs by entering a build ID: 

Note: build_id and run_id are not typical relations. They are numeric values used to link the history to the run/build.

Entity Relationships in this flow Description of relationship Reference / relationship fields
Run History Run ALM Octane tracks the history of all runs. run_id, which is an Integer value used as a reference.
Build ALM Octane tracks the history of all builds. build_id, which is an Integer value used as a reference.

Back to top

Flows

Let's create REST API calls step-by-step. Each of these flows will query the previous_runs API resource to find an ID with a specific integer value.

Request all failed runs of a specific build

Create a query clause that searches for the build ID number 1035:

GET ../api/shared_spaces1001/workspaces/1002/previous_runs?query="build_id EQ 1035"

Request all failed runs of a specific test run in the last few days

Create a query clause that has the following criteria:

  1. The query filters for any run with the run ID number 1000.

    GET ../api/shared_spaces/<shared_space_id>/workspaces/1002/previous_runs?query="run_id EQ 1000"

  2. The query filters for a run_native_status equal to 1077.

    The run's native status is the status of the run as reported by a user (for manual runs) or by the REST API (for automated runs). It can be Passed, Failed, Skipped, Not Completed, Blocked, or Planned.

    Note: Keep in mind that the run's native status is not the same as the run's status. The run's status is a summarized status. It can have only the values Passed, Failed, Planned, and Requires Attention. The purpose of the run status is to standardize the statuses between manual runs and automated runs, and to generate summary graphs in the ALM Octane UI's dashboard.

    GET ../api/shared_spaces/<shared_space_id>/workspaces/1002/previous_runs?query="run_id EQ 1000;run_native_status EQ {id EQ 1077}"

  3. The query uses the run_started field to make sure the run occurred in the last few days. In this flow, the current date might be July 26 2016 or July 27, 2016, for example.

    GET ../api/shared_spaces/<shared_space_id>/workspaces/1002/previous_runs?query="run_id EQ 1000;run_native_status EQ {id EQ 1077};run_started GT ^2016-07-24T07:29:59Z^"

The complete REST API call for this flow is: 

GET ../api/shared_spaces/<shared_space_id>/workspaces/1002/previous_runs?query="run_id EQ 1000;run_native_status EQ {id EQ 1077};run_started GT ^2016-07-24T07:29:59Z^"

Back to top

See also: