Running CTS tests

本文介绍如何使用CTStradefed框架进行连续测试,包括启动测试计划、选择测试包及查看测试进度等关键步骤。适用于Android设备兼容性测试。

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:

  1. Connect at least one device.
  2. Press the home button to set the device to the home screen at the start of CTS.
  3. 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.
  4. 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.
  5. 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
  6. 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. Enter list plans to see a list of test plans in the repository. Enter list 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.
  7. 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.

  8. View test progress and results reported on the console.
  9. 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.

HostDescription
helpDisplay a summary of the most commonly used commands
help allDisplay the complete list of available commands
exitGracefully exit the CTS console. Console will close when all currently running tests are finished
RunDescription
run ctsRun 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-sessionRun 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|64On 64-bit devices, run the test against only the 32-bit or 64-bit ABI
ListDescription
list packagesList all available test packages in the repository
list plansList all available test plans in the repository
list invocationsList 'run' commands currently being executed on devices
list commandsList all 'run' commands currently in the queue waiting to be assigned to devices
list resultsList CTS results currently stored in repository
list devicesList 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

AddDescription
add derivedplan --plan <plan_name>
--result/-r
[pass | fail | timeout | notExecuted]
[--session/-s <session_id>]
Create a plan derived from given result session; use this option to rerun reports and validate test issues
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值