平台

Parallel emulators

Give each worker its own Android emulator, sized to what this machine can run.

本页还没有中文版,下面是英文原文。

A matrix runs your test many times. On Android each run needs an emulator, so more emulators means a faster matrix, up to what the machine can hold.

Size the workers

androidWorkers picks a worker count from the machine:

danwo.config.ts
import { androidWorkers } from "@danwo/mobile"
import { defineConfig } from "@danwo/sdk"

export default defineConfig({
  testDir: "tests",
  workers: androidWorkers({ avd: "danwo_spike" }),
})

An emulator takes its AVD's memory plus about a gigabyte, and two cores. androidWorkers allows as many as half the memory and half the cores fit, at most three by default (max). On a machine already busy past its cores, it allows one.

Give each worker its own emulator with worker: workerIndex in withAndroidDevice. Every boot is read-only, so several emulators share one AVD and its snapshots.

How much faster

The example shop's matrix of 29 runs, on a 12-core, 32 GB Apple silicon machine:

EmulatorsWall timeMedian trial
1160 s4.6 s
2103 s5.6 s
395 s7.1 s

Two emulators are the sweet spot there. A third mostly slows each trial down.

Override it

npx @danwo/cli matrix tests/buy-credits.danwo.ts --workers 2

In CI

RunnerNeeds
LinuxKVM (/dev/kvm) and an x86_64 Google APIs image
macOSApple silicon runs arm64-v8a images

Create the AVD with avdmanager, and save a snapshot so each worker boots in seconds.

Next

本页内容

在每个 Pull Request 上运行

每个 Pull Request 一个 GitHub Check 和一条评论,并附上完整的运行记录。

配置 CI