---
title: "Get test metrics for a project's workflows"
method: GET
path: "/insights/{project-slug}/workflows/{workflow-name}/test-metrics"
tags: ["Insights"]
---

# Get test metrics for a project's workflows

`GET /insights/{project-slug}/workflows/{workflow-name}/test-metrics`

## Request

- Base URL: `https://circleci.com/api/v2`
- URL: `https://circleci.com/api/v2/insights/{project-slug}/workflows/{workflow-name}/test-metrics`
- Auth: one of:
  - API key in header `Circle-Token`
  - HTTP bearer
  - HTTP basic
  - API key in query parameter `circle-token`

Get test metrics for a project's workflows. Currently tests metrics are calculated based on 10 most recent workflow runs.

## Path parameters

- `project-slug` string, required
- `workflow-name` string, required

## Query parameters

- `branch` string
- `all-branches` boolean

## Response `200`

A list of test metrics by workflow

- object: Project level test metrics response
  - `average_test_count` integer, required: The average number of tests executed per run
  - `most_failed_tests` object[], required: Metrics for the most frequently failing tests
    - `p95_duration` number, double, required: The 95th percentile duration, in seconds, among a group of test runs.
    - `total_runs` integer, required: The total number of times the test was run.
    - `classname` string, required: The class the test belongs to.
    - `failed_runs` integer, required: The number of times the test failed
    - `flaky` boolean, required: Whether the test is flaky.
    - `source` string, required: The source of the test.
    - `file` string, required: The file the test belongs to.
    - `job_name` string, required: The name of the job.
    - `test_name` string, required: The name of the test.
  - `most_failed_tests_extra` integer, required: The number of tests with the same success rate being omitted from most_failed_tests
  - `slowest_tests` object[], required: Metrics for the slowest running tests
    - `p95_duration` number, double, required: The 95th percentile duration, in seconds, among a group of test runs.
    - `total_runs` integer, required: The total number of times the test was run.
    - `classname` string, required: The class the test belongs to.
    - `failed_runs` integer, required: The number of times the test failed
    - `flaky` boolean, required: Whether the test is flaky.
    - `source` string, required: The source of the test.
    - `file` string, required: The file the test belongs to.
    - `job_name` string, required: The name of the job.
    - `test_name` string, required: The name of the test.
  - `slowest_tests_extra` integer, required: The number of tests with the same duration rate being omitted from slowest_tests
  - `total_test_runs` integer, required: The total number of test runs
  - `test_runs` object[], required: Test counts grouped by pipeline number and workflow id
    - `pipeline_number` integer, required: The number of the pipeline associated with the provided test counts
    - `workflow_id` unknown, required
    - `success_rate` number, float, required: The success rate calculated from test counts
    - `test_counts` object, required: Test counts for a given pipeline number
      - `error` integer, required: The number of tests with the error status
      - `failure` integer, required: The number of tests with the failure status
      - `skipped` integer, required: The number of tests with the skipped status
      - `success` integer, required: The number of tests with the success status
      - `total` integer, required: The total number of tests

## Other responses

- `default`: Error response.

---

[API](https://skmtc.dev/circleci/apis/circleci-api.md) - [All operations](https://skmtc.dev/circleci/apis/circleci-api/llms.txt) - [OpenAPI document](https://skmtc.dev/circleci/apis/circleci-api/revisions/b9c0e0c24058?raw)
