Statistics
The SDK provides built-in methods for querying aggregated statistics across test runs and test results. Use these to build dashboards, generate reports, or analyze trends without writing manual API calls.
Two collection-level methods are available:
TestRuns.stats()— aggregated test run statistics (status distribution, result breakdown, timeline, top executors)TestResults.stats()— aggregated test result statistics (pass rates by metric, behavior, category, topic, timeline)
Test Run Statistics
Use TestRuns.stats() to get aggregated data across all test runs in your organization.
Available Modes
| Mode | Description |
|---|---|
ALL | Complete dataset with all sections |
SUMMARY | Overall summary and metadata only |
STATUS | Status distribution (Completed, Partial, Failed, etc.) |
RESULTS | Test result pass/fail/pending breakdown |
TEST_SETS | Most frequently run test sets |
EXECUTORS | Top test executors |
TIMELINE | Monthly trend data |
Usage
Test Result Statistics
Use TestResults.stats() to get pass/fail breakdowns across test results, grouped by different dimensions.
Available Modes
| Mode | Description |
|---|---|
ALL | Complete dataset with all sections |
SUMMARY | Overall pass rates and metadata only |
METRICS | Pass rates per evaluation metric |
BEHAVIOR | Pass rates per behavior |
CATEGORY | Pass rates per category |
TOPIC | Pass rates per topic |
OVERALL | Aggregate pass/fail rates |
TIMELINE | Monthly trend data |
TEST_RUNS | Per-run summary breakdown |
Usage
Filtering
Both methods accept filter parameters to narrow results by time range, test sets, users, and more.
| Parameter | Type | Description |
|---|---|---|
months | int | Months of historical data (default: 6) |
top | int | Max items in ranked lists |
start_date | str | ISO date, overrides months |
end_date | str | ISO date, overrides months |
test_set_ids | list | Filter by test set IDs |
test_run_ids | list | Filter by test run IDs |
user_ids | list | Filter by user IDs |
Pandas Integration
Both TestRunStats and TestResultStats provide a to_dataframe() method for converting results to pandas DataFrames. This is useful for charting and further analysis in notebooks.
pandas is an optional dependency. Install it with pip install pandas if you want to use to_dataframe().
Next Steps
- Review Test Runs & Results for entity-level operations
- Explore SDK Metrics for evaluation metric details
- See Test Execution for running tests programmatically