Skip to main content

Inspecting a test

Get the current state of a single test by ID:
The response shows the test’s status, type, plan step count, when it was created, and which surface last authored it:
List all tests in a project with filters:
Narrow by type, originating surface, or status:

Step-by-step results

test steps returns the cumulative execution log for a test — every step from every run, in order:
Scope the output to a single run with --run-id:
Each entry shows the step name, its status (passed or failed), and the run it belongs to. Use --page-size and --max-items for large histories.
Steps logged before run IDs were tracked are excluded when you supply --run-id. If you need those older entries, query without the flag.

The latest result

test result returns the outcome of the most recent completed run for a test:
Add --include-analysis to attach the AI triage block — root-cause hypothesis, recommended fix target, failure kind, and the snapshot ID that ties all artifacts together:
For backend tests, the result also surfaces the run’s captured stdout (apiOutput) and Python traceback (trace) — full content under --output json (and inside failure bundles as result.json / failure.json); text mode prints a bounded 20-line tail of each.
The analysis fields are especially useful when piping to an agent:

Run history

Pass --history to list prior runs instead of the latest result:
Filter by trigger source or time window:
Paginate long histories:

Triaging a failure

When a test is failed, start with the one-screen triage card:
This prints the status, failure kind, root-cause hypothesis, and recommended fix target — everything you need to decide what to do next, without downloading anything. To pull the full failure bundle to disk:
The bundle is one self-consistent, run-scoped package — failing step, DOM snapshots as text, test source, and root-cause analysis, all anchored to one snapshotId. See Failure Bundle for the full contents. Add --failed-only to keep only the failing step and its neighbors (±1), trimming the bundle for faster agent context loading:

Pinning to a specific run

test failure get always returns the latest failing run for a test — that pointer moves if a new run comes in. When multiple runs might be in flight simultaneously, pin to an exact run with test artifact get:
The artifact bundle for a specific run is immutable — a concurrent Portal or schedule run cannot overwrite it. This is the safe path for agents and CI pipelines where two runs of the same test might overlap.
Use test failure get <test-id> for the interactive triage loop. Use test artifact get <run-id> in scripts and CI where you need a stable, run-scoped bundle that a concurrent run can’t shift under you.
The default output directory is ./.testsprite/runs/<run-id>/. The parent directory must exist before you run the command.

Reading test code

Print the generated test code to stdout:
Save it to a file instead:
The response includes the language, framework, code content, and the codeVersion token — useful if you plan to update the code with testsprite test code put and want protection against overwriting a concurrent edit.

Where to Go Next

Running Tests

Trigger runs, wait for verdicts, and understand exit codes

Rerun & Auto-Heal

Replay a test cheaply or let AI repair UI drift

Key Terms

runId, codeVersion, snapshotId, and the rest of the vocabulary

Command Reference

Full flag listing for every CLI command