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.
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.
Figure 2. Device actions for virtual devices
Setting test resources
Cuttlefish virtual devices require three test resources, the virtual machine
tools, the images, and
Acloud.
In a typical Cuttlefish build (for example,
aosp_cf_x86_64_phone
on
ci.android.com
), the virtual machine tools are packed in cvd-host_package.tar.gz
, and
the images are in aosp_cf_x86_64_phone-img-*.zip
. The Acloud binary is built
in ATS and is compatible with all versions of Cuttlefish. The default download
URL of the Acloud binary only needs to be changed for debugging purposes.
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.
Figure 4. Test run results