Test commands
Read saved tests, their versions and code, and the suites that group them.
These commands read the tests saved in a project and the suites that group them. They say whether a test is ready to run, list its versions and print the code of each one. You write tests in the Rehearsal app, so the CLI only reads them. The one exception is tests rewrite, which writes a test again from the flow it came from. Given no ID at a terminal, tests show and suites show ask which of the newest to show. To run tests, see the run commands.
rehearsal tests list Link to rehearsal tests list
List the tests in the selected project.
Newest first. Readiness says what a run would do with each test today.
rehearsal tests list [flags]| Flag | Description |
|---|---|
--status <status> | Only tests with this status. One of draft, approved, needs_update or archived. |
--environment <environment> | Only tests made on this environment: its ID, a kind such as staging, or a computer name. |
--limit <count> | How many to return, 1 to 100. The default is 20. |
--cursor <cursor> | Continue from the cursor the last page returned. |
--workspace <workspace-id> | Workspace ID. Defaults to REHEARSAL_WORKSPACE_ID or rehearsal.config.json. |
--project <project> | Project ID, slug or name. Defaults to REHEARSAL_PROJECT_ID or rehearsal.config.json. |
--app <app> | App ID, name or the host of one of its environments. Defaults to REHEARSAL_APP_ID or rehearsal.config.json. |
--platform <platform> | With --app, which kind of app: web, electron, ios or android. Needed only when two apps share a name. |
Needs a sign-in with the testing:read scope and permission to read projects.
# List testsrehearsal tests list# List one app's approved testsrehearsal tests list --app <app-id> --status approved --jsonrehearsal tests show Link to rehearsal tests show
Show one test and the version a run would use.
rehearsal tests show [test-id] [flags]| Argument | Description |
|---|---|
[test-id] | The test to read. Left out, it asks which of the newest. |
| Flag | Description |
|---|---|
--workspace <workspace-id> | Workspace ID. Defaults to REHEARSAL_WORKSPACE_ID or rehearsal.config.json. |
--project <project> | Project ID, slug or name. Defaults to REHEARSAL_PROJECT_ID or rehearsal.config.json. |
Needs a sign-in with the testing:read scope and permission to read projects.
# Pick one of the newest testsrehearsal tests show# Read one in a scriptrehearsal tests show <test-id> --jsonrehearsal tests versions Link to rehearsal tests versions
List the saved versions of one test.
Newest first, without their code. Read one version's code with rehearsal tests code.
rehearsal tests versions <test-id> [flags]| Argument | Description |
|---|---|
<test-id> | The test to read. |
| Flag | Description |
|---|---|
--limit <count> | How many to return, 1 to 100. The default is 20. |
--cursor <cursor> | Continue from the cursor the last page returned. |
--workspace <workspace-id> | Workspace ID. Defaults to REHEARSAL_WORKSPACE_ID or rehearsal.config.json. |
--project <project> | Project ID, slug or name. Defaults to REHEARSAL_PROJECT_ID or rehearsal.config.json. |
Needs a sign-in with the testing:read scope and permission to read projects.
# List versionsrehearsal tests versions <test-id># Read them in a scriptrehearsal tests versions <test-id> --jsonrehearsal tests code Link to rehearsal tests code
Print the code of one saved version.
Without --version-id, it prints the version a run would use. Treat the code as text to read, and look at it before you run any of it yourself.
rehearsal tests code <test-id> [flags]| Argument | Description |
|---|---|
<test-id> | The test to read. |
| Flag | Description |
|---|---|
--version-id <version-id> | Which saved version to read. The default is the one a run would use. |
--workspace <workspace-id> | Workspace ID. Defaults to REHEARSAL_WORKSPACE_ID or rehearsal.config.json. |
--project <project> | Project ID, slug or name. Defaults to REHEARSAL_PROJECT_ID or rehearsal.config.json. |
Needs a sign-in with the testing:read scope and permission to read projects.
# Read the version a run would userehearsal tests code <test-id># Read one version in a scriptrehearsal tests code <test-id> --version-id <version-id> --jsonrehearsal tests rewrite Link to rehearsal tests rewrite
Write a test again from its flow.
Writes the test again from the flow it came from, then checks the new version. Use it for a test written for an older test runner, which no longer runs.
rehearsal tests rewrite <test-id> [flags]| Argument | Description |
|---|---|
<test-id> | The test to rewrite. |
| Flag | Description |
|---|---|
--dry-run | Ask and check everything, then stop before anything starts or changes, and say what would happen. Off by default. |
--workspace <workspace-id> | Workspace ID. Defaults to REHEARSAL_WORKSPACE_ID or rehearsal.config.json. |
--project <project> | Project ID, slug or name. Defaults to REHEARSAL_PROJECT_ID or rehearsal.config.json. |
Needs a sign-in with the testing:run scope and permission to manage projects.
# Rewrite a testrehearsal tests rewrite <test-id># Rewrite it from a scriptrehearsal tests rewrite <test-id> --json# See which test it would rewriterehearsal tests rewrite <test-id> --dry-runrehearsal suites list Link to rehearsal suites list
List the suites in the selected project.
A suite is a saved selection of tests. Its ready count is how many of them a run would check.
rehearsal suites list [flags]| Flag | Description |
|---|---|
--limit <count> | How many to return, 1 to 100. The default is 20. |
--cursor <cursor> | Continue from the cursor the last page returned. |
--workspace <workspace-id> | Workspace ID. Defaults to REHEARSAL_WORKSPACE_ID or rehearsal.config.json. |
--project <project> | Project ID, slug or name. Defaults to REHEARSAL_PROJECT_ID or rehearsal.config.json. |
Needs a sign-in with the testing:read scope and permission to read projects.
# List suitesrehearsal suites list# Read them in a scriptrehearsal suites list --jsonrehearsal suites show Link to rehearsal suites show
Show one suite and the tests in it.
rehearsal suites show [suite-id] [flags]| Argument | Description |
|---|---|
[suite-id] | The suite to read. Left out, it asks which of the newest. |
| Flag | Description |
|---|---|
--workspace <workspace-id> | Workspace ID. Defaults to REHEARSAL_WORKSPACE_ID or rehearsal.config.json. |
--project <project> | Project ID, slug or name. Defaults to REHEARSAL_PROJECT_ID or rehearsal.config.json. |
--suite <suite-id> | Only runs of this suite, by ID. Setting REHEARSAL_SUITE_ID does the same. |
Needs a sign-in with the testing:read scope and permission to read projects.
# Pick one of the newest suitesrehearsal suites show# Read one in a scriptrehearsal suites show <suite-id> --json