Specify and start devices

Learn how to launch Android and iOS virtual devices using the Maestro CLI, identify connected hardware, and target specific devices for local testing.

When managing multiple simulators, emulators, or physical devices, Maestro needs to know which one to target. This guide covers how to spin up new virtual devices using Maestro, find their identifiers, and target specific hardware for your tests.

Start a device

Maestro allows you to create and launch Android emulators or iOS simulators directly from the CLI. These devices are configured to approximate the environment hosted on Maestro Cloud, ensuring your Flows are compatible when you scale up.

To view all available options and configurations available, run:

maestro start-device

Maestro will list the devices, platforms, and OS versions available in the cloud, similar to the following example:

Supported device types: iPhone11 (iOS), Pixel 6 (Android)
      --os-version=<osVersion>
                       OS version to use:
                       iOS: 16, 17, 18
                       Android: 28, 29, 30, 31, 33
      --platform=<platform>
                       Platforms: android, ios

To create and launch a default Android emulator (Pixel 6, Google API 30), run:

maestro start-device --platform android

If the device already exists, Maestro will simply launch it.

circle-info

Compatibility

The device configurations created by this command are limited to specific OS versions and models supported by Maestro.

Find the device identifier

Once your devices are running, you need to obtain their unique identifier (ID) to target them specifically.

To list available Android devices, run the following command in your terminal:

From the output, locate the device identifier for the device you want to use with Maestro.

Target a specific device

To run a test on a specific device, use the --device flag. This flag must be provided before the test command.

When running a Flow with the Maestro CLI, you can explicitly define the target device. For example, to run flow.yaml on an iOS simulator with the identifier 5B6D77EF-2AE9-47D0-9A62-70A1ABBC5FA2, use the following command:

If you are using Maestro Studio, you can select a device through the interface. At the top of Maestro Studio, click No device connected to see a list of all available devices.

Run tests in parallel (Sharding)

If you have multiple devices running, you can speed up your local execution by "sharding" your tests. This allows you to utilize all available hardware simultaneously. You have two options to use sharding:

  • --shard-all

  • --shard-split

circle-info

Maestro Cloud

Maestro Cloud handles device allocation and parallelization automatically. Sharding flags are primarily for local development and local CI runners.

Strategy A: --shard-all

Use this to run the exact same test collection across multiple devices. This is ideal for cross-platform validation or checking for flaky tests.

Strategy B: --shard-split

Use this to divide your suite. If you have 9 tests and 3 devices, Maestro will run 3 unique tests on each device, finishing the run in roughly one-third of the time.

You can explicitly specify which devices to use for sharding by passing a comma-separated list to the --device flag. For example, if you have three devices running (emulator-5554, emulator-5555, emulator-5556) but only want to shard across two of them:

circle-exclamation

--shard-all and --shard-split

Screenshots when sharding

When sharding, you're using the same workspace on multiple devices at the same time. Taking a screenshot with the same name will cause overwriting. Look at the available environment variables to differentiate.

Last updated