> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testsprite.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reading Results

> Inspect individual tests, step-by-step execution logs, run history, and failure bundles from the CLI.

## Inspecting a test

```bash theme={null}
testsprite test get test_3a9f21c7
```

```text theme={null}
id:            test_3a9f21c7
projectId:     proj_8f0f6
name:          Checkout flow — guest user
type:          frontend
createdFrom:   cli
status:        passed
planSteps:     3
  1. [action] Navigate to /checkout as a guest.
  2. [action] Enter the shipping address and click 'Continue'.
  3. [assertion] Verify the order summary shows the correct total.
createdAt:     2026-06-10T08:14:22Z
updatedAt:     2026-06-15T10:04:38Z
```

List tests in a project, optionally filtered:

```bash theme={null}
testsprite test list --project proj_8f0f6 --type frontend --status failed,blocked
```

| Flag | Values | Description |
| :- | :- | :- |
| `--type` | `frontend` \| `backend` | Test type |
| `--created-from` | `portal` \| `mcp` \| `cli` | Authoring surface |
| `--status` | comma-separated | `draft`, `ready`, `queued`, `running`, `passed`, `failed`, `blocked`, `cancelled`, `unknown` |
| `--env <name>` | environment name | Show statuses for that environment (adds an `ENV` column) |
| `--page-size <n>` | 1–100, default 25 | Items per page |
| `--starting-token <token>` | opaque cursor | Continue from a previous page |

### Status is per environment

`test list` and `test get` without `--env` show each frontend test's latest result in the project's **default environment**, and `--status` filters on that, not on the latest run in any environment. Use `--env <name>` to read another environment. A `--target-url` run is recorded under its temporary environment and does not change the listed status. `project list` and `project get` show the default environment and environment count.

## Step-by-step results

`test steps` returns the step log of the latest run, or of a specific run:

```bash theme={null}
testsprite test steps test_3a9f21c7 --run-id run_5c1d9a2b
```

Each entry has the step name, its status (<kbd>passed</kbd> or <kbd>failed</kbd>), and its run. Use `--page-size` and `--max-items` for long logs. Steps logged before run IDs were tracked are excluded when you pass `--run-id`.

## The latest result

```bash theme={null}
testsprite test result test_3a9f21c7
```

Without `--env` or `--history`, this shows the newest run across **all** environments, even if still running. In text output, if that run is not on the Default environment, a line follows with the Default environment's status and the command to read that environment's history (omitted with `--output json`, `--env`, `--history`, or when the Default status cannot be read). `--env` requires `--history`.

`--include-analysis` adds the AI triage block: root-cause hypothesis, recommended fix target, failure kind, and the `snapshotId` tying all artifacts together.

```bash theme={null}
testsprite test result test_3a9f21c7 --include-analysis --output json \
  | jq '{hypothesis: .analysis.rootCauseHypothesis, fix: .analysis.recommendedFixTarget}'
```

For **backend tests** the result also carries the captured stdout (`apiOutput`) and Python traceback (`trace`): full under `--output json` (and in failure bundles as `result.json` / `failure.json`), a 20-line tail of each in text mode.

## Run history

```bash theme={null}
testsprite test result test_3a9f21c7 --history --source cli --since 7d
```

`targetUrl` is the address the run started against and stays that way after an environment URL edit; URL userinfo is removed before storage. If a new run still visits an old host, check the saved test steps ([Environments](https://docs.testsprite.com/cli/core/environments.md)).

| Flag | Values | Description |
| :- | :- | :- |
| `--source` | `cli` \| `portal` \| `mcp` \| `schedule` \| `github_action` | What triggered the run |
| `--since` | `24h`, `7d`, or ISO timestamp | Earliest `createdAt` |
| `--page-size <n>` | 1–100, default 20 | Items per page |
| `--cursor <token>` | opaque cursor | Continue from a previous page |
| `--env <name>` | environment name | Only runs that used this environment |
| `--rerun` \| `--no-rerun` | flag | Only reruns, or only fresh runs |
| `--columns <list>` | column names | Text output: select or reorder columns |
| `--no-header` | flag | Text output: suppress the header row |

## Triaging a failure

For a <kbd>failed</kbd> test, start with the one-screen triage card (status, failure kind, root-cause hypothesis, recommended fix target):

```bash theme={null}
testsprite test failure summary test_3a9f21c7
```

To pull the full failure bundle to disk:

```bash theme={null}
mkdir -p .testsprite
testsprite test failure get test_3a9f21c7 --out ./.testsprite/failure
```

`--out` creates the bundle directory but not its parent; a missing parent exits 5. Without `--out`, the bundle prints to stdout. The bundle holds the failing step, DOM snapshots as text, test source, and root-cause analysis, all tied to one `snapshotId` (see [Failure Bundle](https://docs.testsprite.com/cli/concepts/key-terms.md#failure-bundle)). `--failed-only` keeps only the failing step and its neighbors (±1) for faster agent context loading.

## Pinning to a specific run

`test failure get` always returns the *latest* failing run, which moves when a new run arrives. To pin an exact run:

```bash theme={null}
testsprite test artifact get run_5c1d9a2b
```

Without `--out`, the bundle goes to `./.testsprite/runs/<run-id>/` (directories created). With `--out <dir>`, the parent of `<dir>` must exist. The bundle is immutable, so a concurrent Portal or schedule run cannot overwrite it. Use `test failure get <test-id>` for interactive triage and `test artifact get <run-id>` in scripts and CI.

### When there is no bundle

The bundle includes the test's saved code. A frontend test gets saved code when it passes against a public URL; a tunnel (`--local`) run never saves code. If the test has never passed, or has only run through a tunnel, `test failure get` and `test artifact get` exit 4 with reason `no_code`. A cancelled run exits 4 with `cancelled_no_artifacts`. In both cases `test steps --run-id <run-id>` and `test failure summary <test-id>` still work.

Backend bundles contain saved code and failure analysis (with stdout and traceback when available) but no step log. Use `test artifact get <run-id>`; on the V3 execution path `test failure get <test-id>` also returns backend bundles.

## Reading test code

```bash theme={null}
testsprite test code get test_3a9f21c7 --out ./checkout_flow.py
```

Without `--out` the code prints to stdout; the file's parent directory must exist. The response includes the language, framework, code, and a `codeVersion` token that protects `testsprite test code put` from overwriting a concurrent edit.

## Where to Go Next

> [card] [Running Tests](https://docs.testsprite.com/cli/core/running-tests.md)
>
> Trigger runs, wait for verdicts, and understand exit codes

> [card] [Rerun & Auto-Heal](https://docs.testsprite.com/cli/core/rerun-and-auto-heal.md)
>
> Re-run a test or let AI repair UI drift

> [card] [Key Terms](https://docs.testsprite.com/cli/concepts/key-terms.md)
>
> runId, codeVersion, snapshotId, and the rest of the vocabulary

> [card] [Command Reference](https://docs.testsprite.com/cli/reference/command-reference.md)
>
> Full flag listing for every CLI command


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.