Skip to main content
POST
/
flaky-tests
/
list-failing-tests
Get a list of distinct tests that failed in the given time range
curl --request POST \
  --url https://api.trunk.io/v1/flaky-tests/list-failing-tests \
  --header 'Content-Type: application/json' \
  --header 'x-api-token: <api-key>' \
  --data '
{
  "repo": {
    "host": "<string>",
    "owner": "<string>",
    "name": "<string>"
  },
  "org_url_slug": "<string>",
  "start_time": "2023-11-07T05:31:56Z",
  "end_time": "2023-11-07T05:31:56Z",
  "page_query": {
    "page_size": 50,
    "page_token": "<string>"
  }
}
'
{
  "tests": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "repository": {
        "html_url": "<string>"
      },
      "html_url": "<string>",
      "name": "<string>",
      "variant": "<string>",
      "status": {
        "reason": "<string>",
        "timestamp": "2023-11-07T05:31:56Z"
      },
      "most_common_failures": [
        {
          "summary": "<string>",
          "occurrence_count": 1,
          "last_occurrence": "2023-11-07T05:31:56Z"
        }
      ],
      "failure_rate_last_7d": 123,
      "failure_rate_last_24h": 123,
      "codeowners": [
        "<string>"
      ],
      "pull_requests_impacted_last_7d": 1,
      "quarantined": true,
      "file_path": "<string>",
      "parent": "<string>",
      "classname": "<string>",
      "ticket": {
        "html_url": "<string>"
      }
    }
  ],
  "page": {
    "total_rows": 1,
    "total_pages": 1,
    "next_page_token": "<string>",
    "prev_page_token": "<string>",
    "last_page_token": "<string>",
    "page_index": 1
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.trunk.io/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

x-api-token
string
header
required

Body

application/json
repo
object
required

The repository to list tests for.

org_url_slug
string
required

The slug of your organization. Find this at https://app.trunk.io/trunk/settings under "Organization Name" > "Slug"

Example:

"my-trunk-org-slug"

start_time
string<date-time>
required

The start time of the failing tests (inclusive). Must be within 7 days of the end time.

end_time
string<date-time>
required

The end time of the failing tests (exclusive). Must be within 7 days of the start time.

page_query
object
required

Pagination options for the list of tests.

Response

OK

tests
object[]
required

A page of failing test cases.

page
object
required

Pagination information for the list of test cases.