Parallel execution
With a run profile
The parallelism level equals the number of resolved devices. Each device in a run profile
becomes a worker; scenarios are shared out across them. When only a few scenarios run, the number of devices prepared is cut to the number of scenarios (--broadcast is not cut down; a @RunOnSingleDevice / @RunInOrder class counts as one scenario). If some devices cannot be prepared, the run continues on the rest; it stops only when no device of that OS could be prepared. iOS reuses any already-running bridge
and only starts what's missing. A run profile can mix iOS and Android devices in the same
devices list to use iOS and Android devices together in one run (each scenario runs on only one of the two OSes — see below; see profiles.md).
fleetest run --project SampleApp --profile all
A scenario declared with no platform: runs on the run's default OS (ios if the run profile
has any iOS device, otherwise android). A scenario that declares
platform: explicitly, and whose declared OS isn't among the run's devices, is skipped rather
than queued — the other OS's devices in the same profile just sit idle for it. If every selected scenario is skipped this way, the run ends as a success (exit code 0) without running any. To run a
platform-agnostic scenario on both OSes, list both run profiles: --profile ios-run --profile android-run (one invocation runs both; each free machine takes the next profile). On a single Mac the two profiles run one after the other (a machine runs one profile at a time); they run at the same time only when they use different machines.
Without a run profile (manual --port)
Start one bridge per Simulator, on separate ports, then hand run the port list:
fleetest bridge up --device "iPhone 17 Pro" # port 8123
fleetest bridge up --device "iPhone 17 Pro Max" --port 8124
xcrun simctl install "iPhone 17 Pro Max" <path/to/App.app> # install on each device
fleetest run --port 8123 --port 8124 # scenarios are auto-distributed to the workers
fleetest bridge down --all # stop every bridge
Android scenarios in the same run get their own worker automatically (each scenario runs in its own subprocess, so platforms stay isolated).
The Android bridge is installed and started automatically on first use, so you normally do not
start it by hand. To warm up many Emulators before a parallel run, use
fleetest bridge up --platform android (add --serial <S> for one device; without it, every
connected device). bridge down and bridge status take the same --platform android [--serial <S>].
On start the bridge disables the window, transition and animator animations.
While the bridge is running you cannot run uiautomator dump by hand, because the accessibility
connection is effectively exclusive to one client.
Sizing
- More devices is not always faster. Past the point where the Mac is saturated, each scenario
just gets slower, the total time stays flat, and image-based steps (
findImage/existImage) and text visibility check start to fail more often. - So find the knee on your own Mac: add devices a few at a time and stop when the wall time of the run stops dropping. If a run turns red only at the higher count, go back to the lower one.
- A freshly cold-booted Simulator can time out on its accessibility IPC. Workers warm up with a
snapshot automatically at start, but if it still fails, run
bridge upthen launch the app and take one snapshot by hand (MCPft_launchandft_snapshot; see MCP server) before the real run.
Slowing down when the Mac is busy
When the Mac's CPU is very busy, fleetest briefly holds back before the next step (on by default). With the CPU pinned near 100%, image and text checks are more likely to go wrong.
- Right before a step that changes the screen (
tap,type, scrolling,launchAppand so on), it measures the whole Mac's CPU usage at that moment and waits 0.2 s at 90% or more, or 1 s at 95% or more, then runs the step. It waits once per step at most; it never waits for the load to go down. - It does not wait before checks (
exist,textIsand so on) orselect, so that something that disappears right after an action (a Snackbar, say) is not missed. It does not wait while ahold { }is pressing, or beforetap()on an element found by image (findImageand so on) — that taps the position where the image was found, which would go stale. Steps that use a selector read the screen again after the wait and find their target then. - It does not wait before an operation marked
settle: falseeither. Putsettle: falseon an operation that has to be quick — tapping something that disappears, or operating in quick succession. - The wait is counted neither against the step's own limit (
waitSeconds) nor against the scenario's time limit (scenarioTimeout), so it never makes a step or a scenario time out. When the Mac is not busy, nothing waits. - It works the same for physical and virtual devices, on iOS and Android — what it measures is the Mac.
The time spent waiting is recorded in the result JSON (pacingMs per step, and steps.paced /
steps.pacedMs per scenario; see results_analysis.md).
To change the tiers or turn it off, write it in that machine's ~/.config/fleetest/config.json
(on a runner machine, the runner's own file is used).
{
"hostLoadPacing": {
"tiers": [
{ "cpuPercentAtLeast": 90, "delayMs": 200 },
{ "cpuPercentAtLeast": 95, "delayMs": 1000 }
]
}
}
To turn it off, use "hostLoadPacing": { "disabled": true }. If the values are not valid (a usage at
or below 0 or above 100, a negative wait, or the same usage twice), the defaults are used and a
warning is printed once at the start of the run.
--broadcast
--broadcast is the one case that does not share scenarios out: it runs the selected set
once on every device of the run profile (e.g. a warm-up pass), rather than dividing them. It
still needs --profile; --device narrows which devices are included (when devices with the same
name exist on more than one machine, say which machine with --runner or --all-machines; see
Remote runs. When the --device name narrows to just one runner machine, the run goes to that runner machine even without --runner). Results are told apart
by their worker field, since the same scenarioID appears once per device (see
results_analysis.md).
One run at a time per machine
A Mac runs one fleetest run at a time. Two runs on the same machine fight over the same Simulators and the same loopback ports, and the load makes tests unstable — so the second one is not started. This is deliberate, not a limit to work around.
You rarely need a second run anyway: parallelism lives inside one run. Put more devices in the
run profile and the scenarios are shared out across them (the sections above), rather than
starting run twice. To run another profile or project as well, add it to the same run (--profile repeated, or --target <project>:<profile>) instead of starting a second run.
If you do start a second one:
- On the CLI it stops right away with
another fleetest run is already running on this Mac, telling you who started the run in progress and since when. Add--wait-lock <seconds>to queue for it instead of failing; runs are served in the order they got in line. - In the VSCode extension it waits by default, for up to 1 hour. Change it in the Device Monitor's Settings tab, under Machines → Max wait on runner contention (0 fails right away without waiting). While you are in line, the execution log shows your position.
A runner machine follows the same rule: a run dispatched to it takes that machine's one slot, so the runner is busy for everyone until it finishes — see Remote runs.
Other places parallel execution shows up
- The VSCode extension runs the same parallel execution through the
fleetest.profilesetting (see the Device Monitor section of VSCode extension). The extension runs one profile per run; to combine several, use the CLI (--profilerepeated /--target). - LPT ordering (longest-past-runtime-first dispatch) balances the queue across workers using
recent run history;
--no-lpt/--lpt-history-runscontrol it (see running_scenarios.md). - Deterministic replay does not call FM, so it scales with parallelism. Self-healing (locator
fingerprint matching) does not call FM either, so it scales the same way.
screenLooksLikedoes call an on-device FM (one instance per machine), so it is bottlenecked by that regardless of how many devices you run.