Running scenarios (fleetest run)

in Japanese(日本語)

fleetest run executes Swift DSL scenarios deterministically. Playback itself and self-healing (locator fingerprint matching) never call FM. FM is called only by the run profile's fmTextVisibilityCheck / screenLooksLike (both ON by default, on-device only); set both to false and no FM call is made during the run (Run profile settings). This page covers the CLI options; see dry_run.md for --dry-run and self_healing.md for enabling self-healing with --set.

Invoking the CLI

In the rest of this documentation, fleetest is ../fleetest/.build/debug/fleetest in the default layout, where fleetest is cloned next to your work folder. Inside the fleetest clone itself, swift run fleetest does the same.

../fleetest/.build/debug/fleetest run --profile ios-run

Common options

Option Description
--project <project> Test project name (see creating_project.md for the resolution order when omitted)
--profile <profile> Run profile name (profiles/runs/<name>.json). Includes device provisioning and auto-install. Cannot be combined with --platform/--port/--serial/--app-id (the profile supplies all of those) — combining them is an error, not a silent override. fleetest run accepts it more than once (--profile ios-run --profile android-run) to run several profiles of the project in one invocation (shared out the same way as --target below). A repeated --profile has the same restrictions as two or more --targets. fleetest api run rejects a repeated --profile.
--scenario <id> Scenario ID: a class name alone runs every scenario in it, or Class.method for one. Repeatable; defaults to all. @Deleted/@Draft scenarios only run on an exact match
--variant <name> Run only these variants of the run profile's variants (repeatable; default: every variant). An unknown name, or a run profile without variants, is an error before the run. --scenario <Class>.S0010@dark names one unit (scenario × variant) directly (<Class>@dark takes every scenario of the class under that variant); combined with --variant or --failed it keeps only the units both select. --variant requires --profile and cannot be combined with --fleet. With --target, every profile must declare the variant. See Variants
--folder <folder> Scenario folders to run (subfolders directly under scenarios/). Repeatable; combinable with --scenario/--failed
--failed Run only the scenarios that failed last time. Results are recorded per (project, profile) in .fleetest/last-results/ on every run — a scenario that failed under one run profile is not hidden by a green run of a different profile, and a profile-less run has its own bucket. --failed looks at the profile you pass to this same invocation (or the profile-less bucket if you omit --profile). With variants, a unit (scenario × variant) is the thing that failed: --failed re-runs only the failed units. "Failed" means the scenario's last attempt did not pass — this includes scenarios that could not start (no worker/device available, the run was interrupted, or device supply failed), but not scenarios skipped as not applicable (declared for another platform)
--set <key>=<value> Override a run profile key for this run only (repeatable; works with or without --profile; e.g. --set heal=true, --set defaultTimeout=8). The rules — available keys, value types, keys that require --profile — are in Run profile keys
--dry-run Validate steps without touching a device (see dry_run.md)
--report-dir <dir> Directory to write reports to (default: TestProjects/<name>/reports). Cannot be combined with --set reportDir=...
--port <port> iOS bridge port (without --profile). Give it more than once for a manual parallel run (--port 8123 --port 8124; see parallel_execution.md)
--skip-build Skip the swift build before running
--quiet Print only the summary (for CI and agents)
--junit <path> Write a JUnit XML report to this path
--broadcast Run the selected scenarios once on every device of the run profile, instead of sharing them out (e.g. a warm-up). Requires --profile; results are told apart by their worker field (see results_analysis.md)
--no-lpt Disable LPT ordering (longest-past-runtime-first dispatch) and run in scenario ID order
--lpt-history-runs <n> Number of past runs to read for LPT ordering (default 5)
--runner <runner> / --fleet <fleet> Dispatch to a runner machine or a fleet of machines over SSH (see Remote runs)
--wait-lock <seconds> When another run is active on this Mac, queue up and wait for up to this many seconds instead of failing right away
--device <name> Run on only that device of the run profile (repeatable). Also narrows --broadcast
--all-machines When a --device name matches devices on more than one machine, run on every matching machine instead of refusing (requires --device)
--align Before dispatching to one runner machine (--runner <machine>), bring the runner's fleetest clone to this machine's working tree (or --tool-rev) and build it — what fleetest remote align <runner> does, in the same command. Does nothing when the runner already matches. When this machine is behind the runner or the two have diverged, it stops without touching the runner (update this machine instead); it also stops when it cannot read the runner's state, and --tool-rev skips this check (you named the version). Only for a dispatch to one runner machine: a local run, --fleet, --target and a run spread over several machines reject it
--tool-rev <rev> Compare the runner's fleetest version with this commit of the local clone (e.g. HEAD) instead of the working tree. Use it to run "before the fix" on one runner while another runner runs the working tree: fleetest remote align <runnerB> --tool-rev HEAD, then fleetest run --runner <runnerB> --tool-rev HEAD … (add --align to do both in one command). Scenarios are still sent from the working tree. Same scope as --align
--target <project>:<profile> Run several projects/profiles in one invocation (repeat it, e.g. --target AppA:ios-run --target AppB:android-run). A free machine takes the next target whose run profile has devices on it (it may wait if a faster machine would finish that target sooner); when no target is left to start, free machines join a running target scenario by scenario. Each machine runs one target at a time. Cannot be combined with --project/--profile; with two or more targets (a repeated --profile counts too), --broadcast, --fleet, --runner, --dry-run, --scenario, --folder, --failed, --port, --platform, --serial, --app-id, --device and --all-machines are rejected. A response-measurement run profile cannot be one of several targets. Not available in fleetest api run
--platform <ios|android> Target platform without --profile (default ios)
--app-id <bundleID> Bundle ID of the app under test, only needed without --profile (with a profile the app comes from the run profile's app profile). Unrelated to --set app=... (the run profile's app key names an app profile, not a bundle ID)
--serial <s> Android device serial (without --profile)

Run fleetest run --help for the full, current list.

run-file

fleetest run-file <path.swift>... runs one or more .swift files that are not registered in Package.swift (profiles, reports and self-healing are borrowed from an existing project via --project). Useful for a throwaway scenario you do not want to add to the project yet. Accepts --project, --profile, --scenario, --set (e.g. --set heal=true), --report-dir, --port, --app-id, and --platform/--serial.

Exit code and failure semantics

fleetest run exits 0 when everything passed, 1 if anything failed. When a run that spans several machines or several targets is interrupted (Ctrl-C) and scenarios or targets are left unrun, it exits 130. Inside a scenario, a failing command aborts the rest of that scenario (all remaining scenes and steps are skipped) — afterEach() still runs. See testcode_structure.md for the full failure model.

Android

Point the same command at an Emulator/physical device with --platform android, or list an Emulator device name in the run profile. No separate setup step is required — the on-device bridge (AndroidRunner) installs and starts itself on first use.

fleetest run --platform android

Device and bridge management

Command Description
fleetest devices up / devices down Start/stop the union of every run profile's devices (or only one run profile's devices with --profile). devices down without --profile also stops the devices and bridges of every registered runner machine over SSH, in addition to this Mac (add --profile to stop only local devices). devices up acts on this Mac only
fleetest bridge up / bridge down / bridge status Manage the resident bridge (iOS: XCUITest runner / Android: on-device server)