Parallel execution

in Japanese(日本語)

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

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.

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:

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