Skip to main content
GET
/
api
/
v1
/
analytics
/
test-cases
Test Cases Analytics
curl --request GET \
  --url https://dash.empirical.run/api/v1/analytics/test-cases \
  --header 'Authorization: Bearer <token>'
{
  "data": {
    "test_cases": [
      {
        "test_case_id": "<string>",
        "test_name": "<string>",
        "file_path": "<string>",
        "project_name": "<string>",
        "tags": [
          "<string>"
        ],
        "last_run_at": "<string>",
        "metrics": {
          "total_runs": 123,
          "pass_count": 123,
          "fail_count": 123,
          "flaky_count": 123,
          "pass_rate": 123,
          "fail_rate": 123,
          "flaky_rate": 123
        },
        "history": [
          {
            "timestamp": "<string>",
            "status": "<string>",
            "test_run_id": "<string>",
            "environment_id": "<string>",
            "executed_at": "<string>",
            "duration_total": 123,
            "retries": 123
          }
        ]
      }
    ],
    "summary": {
      "total_test_cases": 123,
      "test_cases_with_history": 123
    }
  }
}

Authorizations

Authorization
string
header
required

API key from the Empirical dashboard.

Query Parameters

days
number

Number of days of history (1-90, default 7). Ignored if start_date and end_date are provided.

start_date
string

Start of custom date range (ISO 8601). Must be used together with end_date.

end_date
string

End of custom date range (ISO 8601). Must be used together with start_date.

environment_id
string

Filter by environment ID.

test_case_id
string

Fetch history for a single test case. When provided, search, tags, order_by, order, and limit are ignored.

Substring match on test name or file path.

tags
string

Comma-separated tags to filter by (includes match).

order_by
string

Sort field. Allowed values: fail_rate, flaky_rate, last_run.

order
string

Sort direction. Allowed values: asc, desc.

limit
number

Maximum number of test cases to return (1-500, default 100).

limit_history
number

Maximum history entries per test case (1-100, default 20).

Response

Test case analytics data.

data
object
required