Running CTS tests
Using the CTS tradefed
See the Trade Federation Overview for an explanation of the Trade Federation (tradefed or TF for short) continuous test framework.
To run a test plan:
- Connect at least one device.
- Press the home button to set the device to the home screen at the start of CTS.
- While a device is running tests, it must not be used for any other tasks and must be kept in a stationary position (to avoid triggering sensor activity) with the cameras pointing at an object that could be focused.
- Do not press any keys on the device while the CTS is running. Pressing keys or touching the screen of a test device will interfere with the running tests and may lead to test failures.
- Launch the CTS console by running the cts-tradefed script from the folder where the CTS package has been unzipped, e.g.
$ ./android-cts/tools/cts-tradefed
- You may start the default test plan (containing all of the test packages) by appending:
run cts --plan CTS
This will kick off all the CTS tests required for compatibility. Enterlist plans
to see a list of test plans in the repository. Enterlist packages
to see a list of test packages in the repository. See the CTS command reference or type help for a complete list of supported commands. - Alternately, you may run the CTS plan of your choosing from the command line using:
cts-tradefed run cts --plan
Note: When running Android 6.0 (Marshmallow) CTS only, we recommend you use the
--skip-preconditions
option to skip the experimental pre-conditions feature that may cause issues for when executing CTS tests. - View test progress and results reported on the console.
- If your device is Android 5.0 or later and declares support for an ARM and a x86 ABI, you should run both the ARM and x86 CTS packages.
Selecting CTS plans
The following test plans are available:
- CTS—all tests required for compatibility.
- Signature—the signature verification of all public APIs
- Android—tests for the Android APIs
- Java—tests for the Java core library
- VM—tests for ART or Dalvik
- Performance—performance tests for your implementation
These can be executed with the run cts
command.
CTS console command reference
Table 1. This table summarizes the CTS console commands for various uses.
Host | Description |
---|---|
help | Display a summary of the most commonly used commands |
help all | Display the complete list of available commands |
exit | Gracefully exit the CTS console. Console will close when all currently running tests are finished |
Run | Description |
run cts | Run the specified tests and displays progress information. One of --plan , --package , --class or --continue-session needs to be specified The CTS console can accept other commands while tests are in progress If no devices are connected, the CTS desktop machine (or host) will wait for a device to be connected before starting tests If more than one device is connected, the CTS host will choose a device automatically |
--plan <test_plan_name> | Run the specified test plan |
-- package/-p <test_package_name> [--package/-p <test_package2>...] | Run the specified test packages |
--class/-c <class_name> [--method/-m <test_method_name> | Run the specified test class and/or method |
--continue-session | Run all not executed tests from previous CTS session; the sessions testResult.xml will be updated with the new results |
--shards <number_of_shards> | Shard a CTS run into given number of independent chunks, to run on multiple devices in parallel |
--serial/-s <deviceID> | Run CTS on the specific device |
-t <class_name>#<test_method_name> | Run a specific test method |
--force-abi 32|64 | On 64-bit devices, run the test against only the 32-bit or 64-bit ABI |
List | Description |
list packages | List all available test packages in the repository |
list plans | List all available test plans in the repository |
list invocations | List 'run' commands currently being executed on devices |
list commands | List all 'run' commands currently in the queue waiting to be assigned to devices |
list results | List CTS results currently stored in repository |
list devices | List currently connected devices and their state
'Available' devices are functioning, idle devices, available for running tests
'Unavailable' devices are devices visible via adb, but are not responding to adb commands and won't be allocated for tests
'Allocated' devices are devices currently running tests |
Add | Description |
add derivedplan --plan <plan_name> | Create a plan derived from given result session; use this option to rerun reports and validate test issues |