Share this page

# 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.

In this topic:

## Entity relationship diagrams

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

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 | Track the history of all runs. | run_id, which is an Integer value used as a reference.
Build | Track the history of all builds. | build_id, which is an Integer value used as a reference.

Back to top

## Flows

We will examine two flows:

- Find all failed runs of a specific test run in the last few days.

- Find all failed runs for a specific build.

Each of the 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/<workspace_id>/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/<space_id>/workspaces/<workspace_id>/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/<space_id>/workspaces/<workspace_id>/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/<space_id>/workspaces/<workspace_id>/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/<space_id>/workspaces/<workspace_id>/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:

- How to work with the REST API
- View history (technical preview)
- Common flows and ER diagrams

https://admhelp.microfocus.com ALM Octane 8942
Tips to improve your search results... ALM Octane Help Center ALM Octane Help 23.4-24.3 All View Local Help Center View Online Help Center Version: