Skip to main content
autosana run runs the tests in your .autosana/ folder from the terminal, without opening a pull request. It is shorthand for autosana flows run. There are three ways to run, and the flag you pass decides where the tests come from and where they execute.

Three ways to run

Use --local while you iterate on a flow. Use --cloud to try an edit on real devices before you commit it. Use a branch run for what CI would do: the committed tests, at a commit, on cloud devices.

Before you start

Install the CLI and log in. Run autosana login from inside the repository and the login is stored for that repository, so different repos can use different organizations.
The organization you are logged in as must own the app you run against. A run that reports App not found. Upload a build first. almost always means the login belongs to a different organization than the app. Check autosana whoami before checking anything else. autosana run looks in .autosana/ in the current directory: --local and --cloud take the tests from there, and every mode reads config.yaml from there (a branch run takes its tests from GitHub). Pass --path to point at another folder, for example in a monorepo. (autosana flows validate takes the folder as its argument instead.)

Choosing the tests

Name flows by key and suites by folder:
A flow’s key is its path under .autosana/ without the .flow.yaml ending, so .autosana/checkout/cart.flow.yaml is checkout/cart. A suite’s key is its folder, so the folder .autosana/checkout/ with a _suite.yaml inside is the suite checkout.
A bare name is always read as a flow key. autosana run checkout fails with flow key 'checkout' not found when checkout is a suite folder. Use --suite checkout, or name a flow inside it such as checkout/cart.
--folder takes a folder’s path below .autosana/ and runs every suite and flow beneath it. It works with branch runs and --cloud, not with --local. A branch run also includes tests made in the dashboard and placed in the folder; --cloud runs only the files on disk. --folder needs CLI 0.17.0 or later. A label matches the labels: list in your flow and suite files. Labels set only in the dashboard are not seen. A flow matched by a label runs inside its suite, with the suite’s setup, even when only the flow file carries the label. A flow that belongs to a selected suite runs inside that suite; a flow named by its key runs on its own.

Choosing the app

A run needs to know which of your apps to run against. For a mobile app that is its bundle id and platform. For a web app, --app-id takes its slug: a lowercase id such as my-web-app, the app-id input of the CI action, which the List Apps API returns as the app’s bundle_id. Every run also accepts the app’s UUID.
When several mobile apps share one bundle ID in an environment, pick one with --app-id and --platform. --app-id takes the app’s App ID (for example flow-dev) or its UUID. Add --bundle-id if your organization has more than one bundle ID on that platform. Branch, local, and cloud runs all accept it. A mobile --app-id is a flag only: a mobile entry in config.yaml takes just a bundle_id. autosana apps list shows every app’s bundle ID, App ID, and UUID.
In a terminal, a branch or cloud run that names no app, or names a bundle ID that several apps share, asks which app to use and prints the flags that skip the question next time. With a shared bundle ID, pressing Enter keeps the app named by the bundle ID alone. With no app named there is no default, and when your organization has only one app (on any platform, or on the --platform you passed) the run uses it without asking. Outside a terminal, in CI and scripts, there is no question and no automatic pick: a run that names no app stops with an error, and a shared bundle ID runs the app named by the bundle ID alone. Rather than type these on every run, commit them once in .autosana/config.yaml, next to your flows (key reference in Files & Schema):
With that file, autosana run --cloud --suite checkout needs no app flags: it uses the iOS app because default_platform says so. Add --platform android and it uses the Android one. --platform web, or default_platform: web, uses the app_id. A file with a single entry needs no default_platform at all. A local run picks the entry for whichever platform your autosana up session is on. A value you type beats one from the environment, which beats the file: --bundle-id on the command line wins over the AUTOSANA_BUNDLE_ID variable, which wins over config.yaml. The keys, their rules, and what the file is not (a test, or anything the sync reads) are in Files & Schema. Two more things affect the target:
  • Environment. --environment <name> (or environment: in the file) selects the variable set your flows resolve ${env:…} references against. It is required when one app spans several environments.
  • Local runs on mobile can leave the app out entirely when your organization has a single app for that platform. Cloud and branch runs need it named, by flag, variable, or file. In a terminal they ask instead, or use your only app; in CI and scripts they stop with an error.

Local runs

Start a session on your device or dev server with autosana up, then run against it:
A local run executes your uncommitted YAML on the target that autosana up connected. Web is inferred from --app-id alone; the mobile platform is taken from your session. Use --platform when you have sessions on more than one platform, or --session-id when several sessions match. Set-up details for simulators, emulators, physical phones, and dev servers are on the Local Testing page. On iOS and Android, each local run clears the app’s data, so the app starts signed out. To keep an account you signed into by hand, start the session with autosana up --no-reset. See Keep your app signed in.
Local runs execute your flow’s instructions only. Hooks are not run locally because they manipulate the test environment rather than the target. Use a suite’s setup_flow for setup steps that can run on the target.

Cloud runs

--cloud uploads your uncommitted .autosana/ and runs it on Autosana’s devices, so you can try an edit before committing it. Select any number of flows, suites, or labels:
The first line names the app; the others leave it to config.yaml (see Choosing the app). The tests always come from your working copy. What --branch and --app-build-id choose is only the build: When no build was uploaded from the branch, the run stops and, if the app has an active build, names it so you can pin it with --app-build-id. Unlike --local, a cloud run does execute hooks. Hook scripts in your working copy are uploaded with the flows and take precedence; a hook a flow names that has no file in .autosana/ is taken from the dashboard.

Branch runs

With neither --local nor --cloud, the CLI runs the tests committed on a branch. It reads that branch’s .autosana/ from GitHub, so nothing uncommitted takes part:
--ref defaults to your current branch. Name flows with --flow here; the bare autosana run login form is for --local and --cloud only. The repository comes from your origin remote, or pass --repo owner/name. A branch run is refused when the branch changes max_auto_retries for a test Autosana already stored, from your default branch or from an earlier pull request sync or branch run. Run your checkout of the branch with --cloud instead, or merge the change first. See Auto-Retries. By default the run uses the app build made from the same commit as the tests, so every result names a single commit. Two flags change which build runs: The last row is the one to reach for when you changed only test files: no build exists at your commit, and rebuilding an app that did not change is wasted work. Reach for --build-match branch-latest when you want the branch’s newest build but do not have its ID to hand, in CI for example. If the option you choose matches no build, the run is refused and says so. Autosana never quietly falls back to the app’s active build, because a result that does not name the build it came from is worse than no result.
--build-match needs a branch name. Pass a full commit sha as --ref and the flag is refused, because a sha names no branch to take a latest build from. Name the build with --app-build-id instead, which works with any ref.
The dashboard runs branches too: the run dialogs on the Flows page take a branch and a build, and the build you pick there need not come from that branch.

Limiting concurrency

--max-tests-at-once N lets at most N of the run’s tests, from 1 to 1000, run at the same time; the rest wait their turn. It replaces each suite’s own limit for this run. --cloud and branch runs take it. With --local, the CLI exits with --max-tests-at-once is only valid for cloud runs. See Limiting concurrency for what counts as one test. --max-tests-at-once needs CLI 0.40.0 or later.

What a run prints

Each run that starts is printed as a link you can open, followed by the batch that groups them:
The link opens the run in the dashboard. The command returns as soon as the runs start.

Waiting for the result

Add --wait to any run and the command stays open until the run finishes. It prints each flow’s result as its suite finishes, then a total:
The exit code is 0 only when every flow passed, so a script or a coding agent can act on it directly. A run passes or fails by the same rule as the CI action. Exit code 1 means a flow did not pass, the wait timed out, or the run status could not be read; the last line printed says which. Add --timeout <seconds> to give up after that long. Press Ctrl-C to stop waiting. Either way the run carries on, and the batch id is printed so you can check it later with the Run Status API. --wait needs CLI 0.18.0 or later, and the Details: line needs CLI 0.49.0 or later.

Reading a run’s results

autosana runs show prints one flow run in full: its status, link, timing and device, the error if it errored, the review summary and issues, its setup and teardown hooks, each step with its status, value and screenshot, and links to the video, device log, network log and performance data. A two-device run lists each device’s links. Pass the run ID or its dashboard link:
--wait prints this command for each flow that did not pass. Add --json to get the Get Run Results API response instead. The log and performance links expire after 24 hours; run the command again for fresh ones. runs show needs CLI 0.49.0 or later.

Troubleshooting

App not found. Upload a build first.

The organization the CLI is logged in as does not own an app with that bundle id and platform. Run autosana whoami; if it names the wrong organization, run autosana login from inside the repository. If the organization is right, check the bundle id against the Apps page. A web app is looked up by app id, a mobile app by bundle id and platform.

flow key ‘x’ not found in the working copy

x is not a flow. Either it is a suite folder (use --suite x), or the file is not named <key>.flow.yaml, or you are in a directory without .autosana/ (pass --path).

no build was uploaded with branch_name ‘x’ for this app

A --cloud run found no build uploaded from that branch. Upload one from CI, or pin any build with --app-build-id. The error names the app’s active build when there is one.

My suite won’t run against a branch

A branch run fails with an error naming one or more flow files, instead of starting:
Autosana refuses to run a suite when one of its tests is missing. A suite that runs four tests out of five and still reports a pass would hide the fact that a test never ran. This happens when the suite has no flows: list: its tests are then every .flow.yaml beside its _suite.yaml, and on that branch one of those files could not be read. Possible Causes:
  • The file has a YAML error
  • The file couldn’t be downloaded from GitHub
  • Two files claim the same key, so both were dropped
Solutions:
  • Fix or delete every file the error names. It lists them all at once, so you can repair them in a single commit
  • Run autosana flows validate to reproduce a YAML error or a duplicate key
  • If a file failed to download, start the run again. If the same error comes back, check that the file is committed on that branch
  • Give the suite an explicit flows: list, so its tests are the ones you name rather than whatever the folder contains
Only runs you start against a branch are refused this way. The automatic check on a pull request is unaffected, because suite changes there don’t apply until you merge (see Pull request workflow).

Next Steps