Agent commands

Run one of the named test scripts in a Project's airbuild.yaml and bring back its outputs.

runtest runs a named entry under test: in a Project’s airbuild.yaml and collects the files that entry lists as outputs. It runs inside a Team’s Environment.

Team Where the test runs
Cloud Team ios: the selected source is uploaded to a fresh macOS builder. android_beta: a Linux builder. pocketjs_beta: the Team’s own host.
Mac Team On the Team’s own Mac. --environment and --list-environments are for cloud Teams only.

runtest never signs anything and never asks for an app preview.

Synopsis

Terminal window
runtest <project-id> [--platform <platform>] [--source <directory>] [--script <name>] [--additional-options '<flags>'] [--environment ID] [--no-cache]
runtest <project-id> --follow [--run ID]    # reattach; starts nothing
runtest --cancel [--run ID]
runtest --list-environments
runtest --help

Options

Option Value Default What it does
<project-id> UUID required The Project to test.
--script test name the only entry, when there is one Which entry under test: to run. Required when there are several.
--additional-options one line of flags empty Passed to the script, unchanged, as the additional_options environment variable. Use whitespace-separated flags; no shell expressions or nested quoting.
--platform ios, pocketjs_beta, android_beta the default manifest Reads .airbuild/airbuild.<platform>.yaml instead of the default airbuild.yaml.
--source directory the Project directory Tests that directory (a git worktree, for example), with its own airbuild.yaml if it has one, else the Project’s. Relative to your current directory.
--environment ID from --list-environments the default Cloud Teams: run on another builder environment (macOS and Xcode version).
--no-cache — caches on Runs without the builder caches (airbuild-cache, DerivedData, or Gradle’s build cache for android_beta) and saves none.
--follow — — Reattaches to a run already in progress. On a finished run, says so and replays its saved output. Never starts a run.
--run run ID the running run, else the newest With --follow or --cancel. Needed when several runs are going.
--cancel — — Asks the run to stop; waits up to 30 seconds for confirmation.
--list-environments — — Cloud Teams: lists the builder environments.

runtest refuses --sign, --unsigned, --command and --output. For an inline script with no manifest, use runmacos or runlinux.

What runtest reads from airbuild.yaml

runtest needs version: 3 or 4. It does not need a build: section. It finds the manifest the same way runbuild does.

airbuild.yamlYML
version: 3
test:
  app:
    script: |
      airbuild-xcode test -project App.xcodeproj -scheme App \
        -resultBundlePath .airbuild/artifacts/Tests.xcresult $additional_options
    outputs:
      - .airbuild/artifacts/Tests.xcresult
  unit:
    script: swift test
Key What it is
test.<name> One test entry. Names use only ASCII letters, digits, dots, underscores and hyphens. Each entry takes only script and outputs.
test.<name>.script The Bash script. It runs from the source root with -e -o pipefail.
test.<name>.outputs Optional. Files or directories the script writes, relative to the source root.

Output paths must be concrete and relative: no absolute paths, .., wildcards, symbolic links or special files, and no path inside another. Outputs keep their relative paths in one collected directory.

The script also has airbuild-cache on its PATH to keep files such as node_modules between runs, and on a Mac the first airbuild-xcode install or test brings back the Project’s DerivedData. On android_beta, runtest restores and saves Gradle’s build cache itself.

Output

• Build started in the Environment. Run: <run-id>
• It runs to completion even if this command is interrupted (reattach with: runtest <project-id> --follow --run <run-id>).
Airbuild remote execution
… the test script's output …
✓ Command succeeded in <time>.

✓ Test finished.
  Build: <build-id>
  Artifact: <path to the collected outputs>

A failed run still brings back the outputs that exist, and runtest exits with the script’s exit code:

✗ Test failed.
  Reason: <why>
  Artifact: <path to the collected outputs>

Without outputs, it prints No outputs requested; skipping artifact download.

Running several

runtest has its own slot, separate from runbuild, runmacos and runlinux. Cloud Teams run several runtest executions at once, each on a fresh builder; Mac Teams run one at a time. Starting one prints its run ID; when several are running, --follow and --cancel need --run ID. Ctrl-C only detaches.

Exit codes

Code Meaning
0 The script passed and every declared output was written.
1 The run could not start or was lost.
2 A wrong option or argument; nothing ran.
65 The script passed, but a declared output is missing or cannot be exported.
130 Canceled, or detached with Ctrl-C.
other The test script’s own exit code.

Errors

Message What to do
runtest requires airbuild.yaml with version: 3 or 4 and named test scripts. Add a manifest with a test: section.
runtest requires airbuild.yaml version: 3 or 4. Set version: 3 or version: 4 in the manifest.
test must contain named scripts; names use only ASCII letters, digits, dots, underscores and hyphens. Fix the test: section.
Select a test with --script. Available scripts: … Pass --script with one of the names listed.
--additional-options must be a single line. Remove line breaks.
Outputs must be concrete relative paths inside the project, without parent traversal or glob patterns. Fix outputs.
Output paths must not repeat or contain another declared output. Remove the overlap.
Declared output was not produced: <path> Make the script write it, or remove it from outputs.
Cannot export a symbolic link: <path> / Output contains a symbolic link or special file: <path> Export regular files and directories only.
runtest does not accept build or signing options. Drop --sign / --unsigned.
A runtest execution is already running in this Team's Environment. Follow or cancel it.
N runtest executions are running; choose one with --run. Pass one of the run IDs it lists.

Examples

Terminal window
# The only test entry
runtest 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10
Terminal window
# One XCTest class from the "app" entry
runtest 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10 --script app \
  --additional-options '-only-testing:AppTests/ExampleTests'
Terminal window
# Android tests
runtest 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10 --platform android_beta