# Exploratory tests

Start an exploratory test: a Cofactor agent drives a real browser against your
application from a free-text prompt, explores, and reports what it finds. Use it
when you want an agent to explore (try a flow, look for problems) instead of
driving the browser yourself with `cofactor session guide`.

**Feedback.** Tell Cofactor the moment a step in this guide is wrong, unclear or missing; a command fails in a way the guide did not predict; you took a detour or had to guess; or a tool you needed does not exist. Send it when it happens, not only at the end: one sentence on what happened and what would have helped. Run `cofactor feedback "<what happened; what would have helped>" --topic instructions --command "cofactor exploratory-test guide <section>"`, or call the `cofactor_feedback_submit` MCP tool with the same text, topic and command. Never include secrets, customer data, real names or URLs; use neutral examples (Acme, example.com).

This is not `cofactor exploration`, which runs product-map cycles, and it is not
a regression test. To write a repeatable test, read
`cofactor workflow guide write-a-test`.

## Start one

```bash
cofactor exploratory-test run --application <name|id> --prompt "Try the checkout flow as a new customer" --wait
cofactor exploratory-test run --application <name|id> --prompt @charter.md --wait
cofactor exploratory-test run --application <name|id> --prompt @charter.md --sandbox-env <name> --wait
```

`--prompt` takes text or `@file` (up to 5,000 characters). Name the goal, the
role the agent acts as and what a problem looks like. `--wait` polls until the
run finishes, prints the status and URL, and exits non-zero unless it
completed. Add `--timeout <seconds>` to change the 1800 second limit.

## Choose the target

With no target flag the application's default ad-hoc environment is used,
else the live one.

- `--environment <name|id>`: a named live environment of the application
- `--credential <name|id>`: sign in with this credential (live targets)
- `--sandbox-env <name>`: a Sandboxes v2 environment of the application.
  Personas come from the environment, so do not combine it with
  `--environment` or `--credential`.

## Choose the flavor

- `--flavor functional` (default) | `ux` | `fuzz`
- `--effort quick` (about 5 minutes) | `standard` (about 15, default) | `deep` (about 30)

`--effort` applies to `fuzz` only. `fuzz` needs `--sandbox-env`. `ux` runs on
live environments only, so do not combine it with `--sandbox-env`.

## Variables

A functional run on a live environment can use its variables
(`cofactor env set-var`): name one in the prompt as `$var.ENV.<name>` and the
agent types it by reference. A sensitive value is never shown to the agent: it
reads `[REDACTED]` in tool results, files and the trace. Screenshots and video
are not masked.

## Read the result

```bash
cofactor exploratory-test get <id>
cofactor exploratory-test list --application <name|id>
cofactor exploratory-test list --flavor ux --page 2 --page-size 20
```

`get` shows the status, summary, issues found, whether a video and trace
exist, and the URL. Run `cofactor exploratory-test --help` for every option.
To run one on a schedule: `cofactor schedule exploratory-test --help`.

## Rules

- Do not put a real password or token in a prompt. Use a credential, a
  persona or a `$var.ENV.<name>` reference.
- Use neutral example names (Acme, example.com) in prompts you save.
