Test Result Status
A test result’s status records whether the test passed its metric evaluations. It is computed once at execution time and stored on the TestResult.status relationship, which is then the source of truth for stats, email, UI, and API.
Status values
TestResultStatus (app/constants.py) has three values:
| Status | Meaning |
|---|---|
Pass | At least one metric exists and every metric has is_successful: true. |
Fail | At least one metric has is_successful: false. |
Error | No metrics were evaluated (missing/empty test_metrics) or the endpoint returned an HTTP error. Counted as an execution error, not a pass or fail. |
A single failed metric fails the whole test.
Test metrics structure
The status is derived from the test_metrics JSON stored on the result:
Two metrics with is_successful: true and one false yields status Fail. All true yields Pass. Missing or empty metrics yields Error.
Determination logic
determine_status_from_metrics (tasks/execution/executors/metrics.py) and create_test_result_record (tasks/execution/executors/results.py) apply the same rule:
Status is set in three places:
- Automated execution by the worker (
executors/results.py). POST /test_resultsandPUT /test_results/\{id\}(app/routers/test_result.py) — auto-set fromtest_metricswhenstatus_idis not provided. Pass an explicitstatus_idto override.
Source of truth
After execution the stored status is authoritative. Statistics and reporting read it through categorize_test_result_status() (app/constants.py), which collapses the status name into a pass/fail/error bucket — they do not re-derive pass/fail from test_metrics. Deriving once at execution time keeps every surface consistent and avoids re-parsing JSONB.
Read test_metrics directly only for per-metric analytics, drill-down, and debugging — never to recompute overall pass/fail. Note that human reviews can override the stored status or individual metric outcomes; statistics account for those overrides.
Test result status vs test run status
| Aspect | Test Result Status | Test Run Status |
|---|---|---|
| Scope | Individual test | Entire test run |
| Question | Did this test pass its metrics? | Did the tests execute? |
| Values | Pass, Fail, Error | Queued, Progress, Completed, Partial, Failed, Cancelled |
| Based on | Metric success | Execution completion |
A test can Fail (a metric didn’t pass) yet still have executed successfully. See Test Run Status for how run status is determined.