Virtual Devices in Android Test Station

Android Test Station supports Cuttlefish virtual devices that let you run tests without physical Android devices. Cuttlefish is suitable for testing hardware-independent functions. Before starting to use virtual devices, follow the user guide to install Android Test Station.

Installing Cuttlefish dependencies

Run the following command to ensure that the necessary kernel modules are loaded:

sudo modprobe -a kvm tun vhost_net vhost_vsock

Starting Android Test Station with virtual devices

To enable virtual devices, run:

mtt start --max_local_virtual_devices N

N is the maximum number of virtual devices that ATS can simultaneously allocate. The default number is 0.

Running a test with virtual devices

Selecting devices

On the device list, ATS displays virtual devices as placeholders instead of their actual serial numbers. The placeholders are shown in the format of HOSTNAME:local-virtual-device-ID. The states are either Available or Allocated. A placeholder in the Available state indicates that the virtual device is not running and can be allocated for the test.

Select Virtual Devices

Figure 1. Selecting virtual devices

Adding device actions

If you select at least one local virtual device, the associated device action should be added to the list automatically. The action consists of the required TradeFed parameters and test resources to create virtual devices.

Virtual Device Actions

Figure 2. Device actions for virtual devices

Setting test resources

Cuttlefish virtual devices require two test resources, the virtual machine tools and the images. In a typical Cuttlefish build (for example, aosp_cf_x86_64_phone on ), the artifact names are cvd-host_package.tar.gz and aosp_cf_x86_64_phone-img-*.zip.

Virtual Device Test Resources

Figure 3. Test resources for virtual devices

Viewing test runs

The device logs, including kernel.log, host_log.txt, and launcher.log are collected in the output file folder. Click View Output Files to see them.

Test Run Results

Figure 4. Test run results