Build tests API

List tests for a build

Returns a paginated list of tests that ran in a Buildkite Pipelines build. Each test includes execution metrics aggregated over the build's time window. The response includes tests from every Buildkite Test Engine suite associated with the build that the API token can access.

The build identifier must be the build UUID, not the pipeline build number.

curl -H "Authorization: Bearer $TOKEN" \
  -X GET "https://api.buildkite.com/v2/analytics/organizations/{org.slug}/builds/{build.id}/tests"
[
  {
    "id": "a915535c-a8f1-4e1a-bd6a-a5589e09f349",
    "url": "https://api.buildkite.com/v2/analytics/organizations/my_great_org/suites/my_suite_name/tests/a915535c-a8f1-4e1a-bd6a-a5589e09f349",
    "web_url": "https://buildkite.com/organizations/my_great_org/analytics/suites/my_suite_name/tests/a915535c-a8f1-4e1a-bd6a-a5589e09f349",
    "scope": "User#email",
    "name": "is correctly formatted",
    "location": "./spec/models/user_spec.rb:42",
    "file_name": "./spec/models/user_spec.rb",
    "labels": ["flaky"],
    "reliability": 0.98,
    "duration_avg": 0.213,
    "duration_sum": 23.856,
    "duration_min": 0.108,
    "duration_max": 1.942,
    "executions_count": 113,
    "executions_count_by_result": {
      "passed": 110,
      "failed": 2,
      "skipped": 1
    }
  }
]

The aggregation window starts when the build is created, unless the organization's maximum Test Engine time window requires a later start. It ends when the build finishes. For a running build, the window ends at the current time. The window cannot extend beyond 24 hours after the build was created.

reliability The reliability of the test, calculated from its passed and failed executions and expressed as a decimal fraction. This is null when the test has no passed or failed executions in the build.
duration_avg The average execution duration, in seconds.
duration_sum The total execution duration, in seconds.
duration_min The shortest execution duration, in seconds.
duration_max The longest execution duration, in seconds.
executions_count The number of executions in the build.
executions_count_by_result The number of executions in the build, broken down by result. The passed and failed counts are always present. The skipped, pending, and unknown counts are only present when they're non-zero.

Query string parameters

Some query string parameters support one or more of the additional operators listed below.

! Excludes the specified value.
* Matches values that start with the specified value.
~ Returns groups that contain at least one matching execution. This operator is only available for the result tag.
^ Returns groups where every execution matches. This operator is only available for the result tag.

Optional query string parameters:

labels Filters the results by a comma-separated list of test labels.

Example: ?labels=flaky,!slow

Supported operators: !

branch Only aggregates executions from branches that match the specified value. Use at most one operator.

Example: ?branch=feature*

Supported operators: ! *

owners Filters the results by a comma-separated list of test owner slugs.

Example: ?owners=payments,!platform

Supported operators: !

state Filters the results by test state. Valid values are enabled, muted, and skipped.

Example: ?state=muted

tags Filters the results by a comma-separated list of execution tags, using key:value syntax. A build.id filter cannot override the build UUID in the request path.

Example: ?tags=framework:!rspec,scm.branch:feature*,result:^passed

Supported operators: ! *. The result tag also supports ^ ~.

sort_by The metric to sort the results by. Valid values are duration_avg, duration_sum, duration_min, duration_max, and reliability. The default value is duration_avg.

Example: ?sort_by=reliability

order The direction to sort the results in. Valid values are asc and desc. The default value is desc.

Example: ?order=asc

This endpoint is paginated.

Required scope: read_suites

Success response: 200 OK