CTS Trade Federation, cts-tradefed for short, is the next generation test harness for CTS.
( CTS Trade Federation,简称cts-tradefed ,是新一代CTS测试工具)
cts-tradefed is built on top of the Android Trade Federation test harness. ( cts-tradefed 建立在Android Trade Federation 测试框架的基础上)
It works in a similar manner to the prior CTS harness, but supports some advanced features such as:
(它的工作方式类似于之前的CTS套件,但是支持一些更高级的功能,例如:)
- modular, flexible extensible design. cts-tradefed can be extended to support running CTS in a continuous test environment.
(模块化,灵活的设计。cts-tradefed能够支持在一个连续的测试环境中运行CTS)
- supports sharding a CTS test run across multiple devices in parallel
(支持在一组设备上同时分别运行CTS)
- automatically continue a CTS test run on another device if connection is lost
(如果测试手机断开了,你还可以使用另外一台手机刷同样的版本继续测试)
Configuring cts-tradefed
(cts-tradefed配置)
1. Ensure 'adb' is in your current PATH. adb can be found in the Android SDK available from http://developer.android.com
(确定adb正确配置到当前路径。通过这个网站http://developer.android.com可以从安卓SDK中找到adb)
Example:
PATH=$PATH:/home/myuser/android-sdk-linux_x86/platform-tools
2. Follow the 'Setting up your device' steps documented in the CTS User Manual. The CTS User Manual can be downloaded at
http://source.android.com/compatibility/downloads.html
(根据CTS用户手册文档中的步骤来设置你的设备。你可以从这里下载用户手册http://source.android.com/compatibility/downloads.html)
3. Connect the device to the host machine.
(连接手机到测试服务器/电脑)
4. Ensure device is visible via 'adb devices'
(确保通过adb devices命令可以找到设备)
Using cts-tradefed
To run a test plan on a single device:
(在一台设备上运行测试计划)
1. Make sure you have at least one device connected
(确保至少有一台设备连接到电脑上)
2. Launch the cts-tradefed console by running the 'cts-tradefed'. If you've downloaded and extracted the CTS zip,
the script can be found at
(运行'cts-tradefed'命令进入cts-tradefed控制台。如果你已经下载并且解压了CTS压缩包,你就能在这里找到这个脚本)
android-cts/tools/cts-tradefed
Or else if you are working from the Android source tree and have run make cts,the script can be found at
(要不然如果你是从安卓源文件启动CTS,你能在这里找到脚本
out/host/linux-x86/cts/android-cts/tools/cts-tradefed
3. Type:For more options:(运行这个命令你可以得到更多有用的信息)
run cts --help/--help-all: 查看更多执行测试命令
run:
run cts --plan test_plan_name: 执行一个测试计划
run cts --package/-p : 执行一个CTS测试包
run cts --class/-c [--method/-m] : 执行一个测试类/方法
run cts --continue-session session_ID: 执行一个测试计划中的未完成部分,命令行输入l r可以查看session ID
run cts [options] --serial/s device_ID: 在指定的设备上执行测试计划
run cts [options] --shards number_of_shards: 在多个设备上执行同一个测试计划
check:
l/list d/devices: 查看连接设计及状态
l/list packages: 查看CTS测试包
l/list p/plans: 查看CTS测试计划
l/list i/invocations: 显示CTS当前执行进度,需要在CTS执行过程中输入才有效
l/list c/commands: 当前CTS测试运行命令队列中等待被分配给设备需要在CTS执行过程中输入才有效
l/list r/results: 查看CTS库列中的测试结果
add plan:add derivedplan --plan plan_name --session/-s session_id -r [pass/fail/notExecuted/timeout]:从给定的会话中添加一个计划
check the log:
d/dump l/logs:查看生成的log
--disable-reboot:防止运行一些脚本时手机重启,在首次执行一个版本的测试时一定要添加这个参数,否则手机会重启
CTS Tradefed Development
See http://source.android.com for instructions on obtaining the Androidplatform source code and setting up a build environment.
这个网址的说明包含了安卓源代码和构建环境
The source for the CTS extensions for tradefed can be found at
你能在这里找到扩展tradefed的CTS源目录<android source root>/cts/tools/tradefed-host
The source for the tradefed framework can be found on the 'tradefed' branch.
tradefed框架的源代码可以在'tradefed'分支里面找到
Perform these steps to build and run cts-tradefed from the development environment:
完成这些步骤你就可以在自己创建的开发环境里面执行cts-tradefedcd <path to android source root>make ctscts-tradefed
More documentation and details on using and extending trade federation will be forthcoming in the near future
不久会有更多关于使用和扩展trade federation的文件和详细信息。