Command line (`atx`)
atx runs tests from the command line with the same engine as the server. It is built
for CI pipelines: one command, a machine-readable result, and a non-zero exit code on
failure. It works two ways:
atx run <test.json>runs a test file on this machine, with no server.atx run --suite <name>asks the AutoTestX server to run a whole suite, and waits for the result. See Running a suite on the server.
From the project folder:
npm run atx -- <command> [options]npm run atx -- passes everything after -- to atx. In PowerShell, quote it: '--'.
PowerShell removes a bare --, so npm keeps the --option flags for itself and passes on only
their values. atx notices and stops with “npm kept –suite … for itself” rather than run
without them. Or call the CLI directly:
node --import tsx packages/cli/src/index.ts run test.json --env env.jsonCommands
Section titled “Commands”| Command | Does |
|---|---|
atx validate <test.json> |
Checks the file against the schema, the step registry and the expression parser |
atx migrate <test.json> [--write] |
Migrates the file to the current DSL version. Prints the result, or overwrites the file with --write. |
atx run <test.json> [options] |
Runs the test in Chromium on this machine |
atx run --suite <name> [options] |
Runs every shared test of a suite on the server and waits for the result |
atx deployed --env <name> [options] |
Records what was deployed to a server environment, so later suite runs there are labelled with it. Takes --server, --release, --build, --commit, --branch, --note, --no-deployment; needs a release or a commit (read from CI by default). See Run after deployment. |
atx help |
Usage |
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
Passed (or valid) |
1 |
Failed (or invalid, for validate) |
2 |
Invalid input: unreadable file, invalid test, missing data columns, bad usage, or a suite run the server refused (unknown suite or environment, missing or wrong token) |
130 |
Interrupted (Ctrl-C). A suite run is stopped on the server first. |
atx run options
Section titled “atx run options”| Option | Meaning |
|---|---|
--env <file.json> |
Environment variables and secrets (see below) |
--artifacts <dir> |
Write screenshots and other artifacts here. Data-driven rows go in <dir>/r1, r2, … |
--screenshots |
Capture a screenshot after every step (default: failures and Screenshot steps only) |
--headed |
Show the browser. Data-driven rows then run one at a time. |
--files <dir> |
Folder that relative Upload file paths resolve from. Default: the test file’s folder. |
--json <file> |
Write the machine-readable result |
--junit <file> |
Write a JUnit XML report, for a CI system’s test tab. A data-driven run is one test case per row. |
--data <file> |
Rows for a data-driven run: a CSV with a header row, or a JSON list of objects |
--concurrency <n> |
Rows at once, when the test declares its rows independent |
Environment file
Section titled “Environment file”{ "name": "Fixture UAT", "variables": { "baseUrl": "https://uat.example.com" }, "secrets": { "APP_USER": "tester", "APP_PASSWORD": "correct horse" }}variables are the environment variables ({{baseUrl}}). secrets are {{secret.NAME}},
masked in the output. Do not commit real secrets. Generate this file in CI from your
secret store.
Examples
Section titled “Examples”Validate:
npm run atx -- validate examples/create-purchase-order.jsonRun with an environment and keep the result:
npm run atx -- run examples/create-purchase-order.json --env examples/fixture.env.json --json result.json
examples/fixture.env.jsonpointsbaseUrlat the fixture app with an absolutefile:///path. Edit it to your project folder first.
Output (shortened):
[PASS] Enter username 400 ms[PASS] Enter password 345 ms[PASS] Sign in 387 ms[PASS] Purchase order list is shown 19 ms…[PASS] Add each order line 2010 ms[PASS] Save the purchase order 342 ms[PASS] Extract the generated PO number 17 ms[PASS] Verify a PO number was generated 0 ms[PASS] Verify the status is Approved 16 ms[PASS] The new order appears in the list 21 ms
PASSED Create Purchase Order18 / 18 steps passed in 4427 msOther markers you may see:
| Marker | Meaning |
|---|---|
[FAIL] |
The step failed. The error is printed on the next line. |
[WARN] … (degraded: css=#btn_new_412) |
Passed using a fallback locator |
[RTRY] attempt 1: … |
A retry, with the reason |
[SKIP] |
Not run |
n soft assertion failure(s) |
Soft assertions failed; the run fails |
Data-driven, with rows from a CSV, three at a time:
npm run atx -- run examples/data-driven/02-dataset-order-totals-parallel.json --env examples/api-demo/environment.json --data examples/data-driven/data/order-lines.csv --concurrency 3Each line is prefixed with its row (r 3). At the end, every failed row is listed with
its inputs (sensitive columns as ***) and the step that failed.
Data-driven tests in the CLI
Section titled “Data-driven tests in the CLI”| Test’s data source | What the CLI uses |
|---|---|
| Inline table | The table, unless --data is given |
| Data set, HTTP request, data pool | These live on the server. Pass the rows with --data. Without it the run stops with an explanation. |
If a step uses {{data.x}} and the rows have no column x, the run stops before starting
(exit code 2).
Running a suite on the server
Section titled “Running a suite on the server”atx run --suite <name> runs nothing locally. The server runs every shared test in
the suite against one of its environments, with the project’s components, data sets and
secrets, exactly as Run on the Test Suites page does. The CLI starts the run, prints
each test as it finishes and exits 0 only when the whole suite passed.
| Option | Meaning |
|---|---|
--suite <name> |
The suite. Upper/lower case and extra spaces do not matter. |
--server <url> |
The AutoTestX server, e.g. https://app.autotestx.com. Or set ATX_SERVER. |
--env <name> |
The server environment to run against, by name (staging) or id. Optional. |
--json <file> |
Write the machine-readable suite result: status, counts and every test with its run id |
--junit <file> |
Write the suite run as JUnit XML, built by the server once the suite has finished. If the server can’t provide it, the CLI says so; the exit code is still the suite’s. |
--timeout <minutes> |
Stop the suite and fail after this long. Default 60. |
--ready |
Run Ready tests only. Drafts are listed as skipped, so a test someone is still editing never blocks a deploy. |
--release <name> |
The version being tested, e.g. v2.14.0. Or set ATX_RELEASE. A build of a git tag sends the tag on its own. |
--build <id>, --commit <sha>, --branch <name> |
The deploy being tested, shown on the suite run. Read from the CI system by default (see below). |
--note <text> |
One line about the deploy, e.g. "hotfix INC-1234" |
--no-deployment |
Do not send the release, commit, branch and pipeline link read from the CI system or ATX_RELEASE |
Deploy details are filled in for you. In GitHub Actions, GitLab CI, Azure Pipelines,
Bitbucket Pipelines and Jenkins, atx run --suite reads the commit, branch, build number
and a link to the pipeline run from the variables the CI system sets, and sends them with
the suite run. On a tag build (GITHUB_REF_TYPE=tag, CI_COMMIT_TAG, BITBUCKET_TAG,
Jenkins TAG_NAME) the tag is sent as the release. The suite run then shows Deploy v2.14.0 ·
github-actions · main @ a1b2c3d · build 42 · pipeline run, and it is listed as deploy in
Recent suite runs. --release, --build, --commit, --branch and --note override
what was detected. See Run after deployment.
The API token is read from the ATX_TOKEN environment variable only - there is no
--token flag, because flags show up in process lists and CI logs. Create a token under
Project → API tokens with the Tester role (a Viewer token cannot start runs).
export ATX_SERVER=https://app.autotestx.comexport ATX_TOKEN=atx_pat_... # from your CI secret storenpm run atx -- run --suite Asset --env staging --json suite-result.jsonOutput:
suite Asset: 3 tests · exec_muyxl6d1qd6q[PASS] Create asset 2/2 steps 0.4s[PASS] Edit asset 2/2 steps 0.4s[FAIL] Retire asset 1/2 steps 2.4s https://app.autotestx.com/#/runs/run_muyxl6pxq3ka
FAILED suite Asset2 / 3 passed, 1 failed in 2.9sA failed test prints a link to its run report. A skipped test (a Deprecated one) prints
[SKIP] with the reason. How many tests run at once is set by your plan.
Stopping. Ctrl-C, a pipeline cancel or --timeout cancels the suite on the server:
tests not yet started are cancelled, and the ones already running finish so their reports
stay whole. The CLI waits for that, then exits.
Things the CLI does not do
Section titled “Things the CLI does not do”atx run <test.json>does not talk to a server. Components called by a test (component.call) are resolved by the server, so a test that calls components must run on the server - for example as part of a suite withatx run --suite.- For a local run there is no project, environment or secret store. Everything comes from files.
In a CI pipeline
Section titled “In a CI pipeline”# GitHub Actions example- run: npm ci- run: npx playwright install --with-deps chromium- run: npm run atx -- run tests/create-po.json --env env.json --json result.json --artifacts artifacts- uses: actions/upload-artifact@v4 if: always() with: { name: autotestx, path: "result.json\nartifacts" }Write env.json from your CI secret store in a step before the run.
Or let the server run a whole suite, with nothing to install but Node:
- run: npm ci- run: npm run atx -- run --suite Asset --env staging --ready --json suite-result.json env: ATX_SERVER: https://app.autotestx.com ATX_TOKEN: ${{ secrets.AUTOTESTX_TOKEN }}