---
title: "Retrieve test flakiness metrics for a workspace"
method: GET
path: "/workspaces/{workspace_id}/reports/testFlakiness"
tags: ["Report"]
---

# Retrieve test flakiness metrics for a workspace

`GET /workspaces/{workspace_id}/reports/testFlakiness`

Returns flakiness metrics for tests in a workspace over a specified time range.
Flakiness is calculated by grouping test runs by execution context (plan_run_id,
browser, mobile device/OS, scenario), then identifying groups with mixed outcomes
(both passes and fails within the same execution context).

The summary statistics reflect ALL matching tests in the workspace, while the
tests array is paginated. Use the cursor parameter to fetch additional pages.

## Path parameters

- `workspace_id` string, required

## Query parameters

- `start_time` integer, required
- `end_time` integer, required
- `application_id` string
- `plan_id` string
- `environment_id` string
- `test_id` string
- `min_plan_runs` integer
- `limit` integer
- `cursor` string

## Response `200`

Test flakiness metrics for the specified time range

- TestFlakinessResult — Test flakiness metrics for a workspace over a time range
  - `workspace_id` string — ID of the workspace
  - `interval_start` integer — Starting time of the reporting window in epoch milliseconds
  - `interval_end` integer — Ending time of the reporting window in epoch milliseconds
  - `summary` TestFlakinessSummary — Aggregate flakiness statistics across ALL matching tests (not limited by pagination)
    - `total_tests` integer — Total number of tests matching the filters with sufficient data in the time range
    - `flaky_tests` integer — Number of tests with any flakiness (flake_rate > 0)
    - `tests_above_threshold` integer — Number of tests with flake_rate >= 10%
    - `average_flake_rate` number, double — Average flake rate across all tests (0.0 to 1.0)
    - `total_flaky_plan_runs` integer — Total number of plan runs with mixed outcomes across all tests
  - `tests` TestFlakinessSummaryItem[] — List of tests with their flakiness metrics, ordered by flake rate descending
    - `test_id` string — The test's invariant ID
    - `flake_rate` number, double — True flake rate (0.0 to 1.0). Calculated as flaky_plan_runs / total_plan_runs.
    - `total_plan_runs` integer — Total number of plan runs that included this test in the time range
    - `flaky_plan_runs` integer — Number of plan runs with mixed outcomes (both passes and fails)
    - `consistent_pass_runs` integer — Number of plan runs where all attempts passed
    - `consistent_fail_runs` integer — Number of plan runs where all attempts failed (likely real failures, not flakiness)
    - `last_flaky_time` integer — Timestamp of the most recent flaky plan run in epoch milliseconds. Null if no flaky runs.
  - `cursor` string — Cursor for fetching the next page of results. Null if no more results.

## Other responses

- `400` — Invalid or missing parameter
- `401` — User not authenticated
- `403` — User not authorized
- `default` — Unexpected error

---

[API](https://skmtc.net/mabl/apis/mabl-api.md) · [All operations](https://skmtc.net/mabl/apis/mabl-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mabl/mabl-api/revisions/d0fc0114da66/schema)
