Skip to main content

Two kinds of tests

TestSprite has two test types, and the authoring model differs between them: TestSprite stores and executes all test code as Python: frontend tests run as async Playwright scripts, backend tests as requests + pytest-style assertions. Accordingly, test code put --language accepts only python.

Create a frontend test from a plan

The plan file is a JSON document that holds the full test definition — projectId, type, name, and the planSteps array. Because everything is in the file, --project, --type, --name, --description, and --priority are ignored when --plan-from is set; use the fields inside the JSON instead. Plan files must be ≤ 256 KB. Example plan file structure:
On success, the CLI prints the new testId, codeVersion, createdAt, and — when the backend supplies it — a dashboardUrl deep-linking to the Portal.

Create a backend test from code

Code files must be ≤ 350 KB. In code-file mode, --project, --type, and --name are all required.

Backend dependency authoring

Backend tests can declare the variables they produce and consume. TestSprite uses these declarations to determine run order — producers execute before consumers, and teardown tests run last — both on test run --all and on rerun. These flags are backend-only and are ignored for frontend tests.

Create and run in one command

Pass --run to trigger a cloud run immediately after the test is created. Add --wait to block until the run reaches a terminal status. Add --output json to get a machine-readable result your agent can parse.
Exit 0 means the run passed. Any non-zero exit means the run failed, was blocked, or timed out — your script can branch directly on $?. See Running Tests for the full run surface, including --timeout, --target-url, and how to resume a timed-out run with test wait <run-id>.

Creating many tests at once

Use test create-batch to create up to 50 frontend tests in a single call. This command is frontend-only.
The server caps run triggers at 60 per minute per key. The CLI throttles to 50 per minute and auto-retries rate-limited requests — you do not need to handle this yourself.
Editing a test’s metadata, replacing its plan or code, and deleting tests all live in Editing & Deleting Tests.

Where to Go Next

Editing & Deleting Tests

Update metadata, replace a plan or code, and delete tests

Running Tests

Trigger runs, poll for verdicts, and handle timeouts

Reading Results

Fetch failure bundles, steps, and run history

Command Reference

Full flag listing for every command