本帖最后由 一月蔷薇_456 于 2019-2-14 16:20 编辑
1.下载完整的cts测试工具包,方式有两种: a.在现有代码上编译,代码版本与目标机器版本一致; b.在Google官网下载:http://source.android.com/compatibility/downloads.html,Compatibility Test Suite (CTS)即可。
2.下载media测试内容,还是上边的官网,在网页最下边:CTS Media Files
These media files are required for the CTS media stress tests.
CTS Media 1.0
3.连接手机与电脑(至少一台手机)4.测试前准备android-cts/repository/testcases中的CtsDelegatingAccessibilityService.apk和CtsDeviceAdmin.apk
安装完成以上apk后,在手机端操作: a.设置->辅助程序->Delegating Accessibility Service,打开; b.设置->安全->设备管理器->CTS相关的两个选项都激活; c.打开USB调试模式; d.保持屏幕唤醒; e.允许模仿位置; f.切换至英文模式US。
5.进入cts控制台执行android-cts/tools/cts-tradefed dev@linux -dev:~/android/CTS/android-cts/tools$ ./cts-tradefed
09-0509:20:52 I/: Detectednew device c8090fe4
09-0509:20:52 I/: Detectednew device5348300e
Android CTS 4.2_r1 我现在连接着两台设备,都检测到了。
6.开始进行CTS测试首先,在控制台中输入help看这个控制台都能干什么。
cts-tf > help
CTS-tradefed host version 4.2_r1
CTS-tradefed is the test harness for running the Android Compatibility Suite, built on top of the tradefed framework.
Available commands and options
Host:
help: show this message
help all: show the complete tradefed help
exit: gracefully exit the cts console, waiting till all invocations are complete
Run:
run cts --plan test_plan_name: run a test plan
run cts --package/-p: run a CTS test package
run cts --class/-c [--method/-m]: run a specific test class and/ormethod
run cts --continue-session session_ID: run all not executed tests from a previous CTS session
run cts [options] --serial/s device_ID: run CTS on specified device
run cts [options] --shards number_of_shards: shard a CTS run into given number of independent chunks, to run on multiple devices inparallel
run cts --help/--help-all: get more help on running CTS
List:
l/list d/devices: list connected devices and their state
l/list packages: list CTS test packages
l/list p/plans: list CTS test plans
l/list i/invocations: list invocations aka CTS test runs currentlyin progress
l/list c/commands: list commands: aka CTS test run commands currently in the queue waiting to be allocated devices
l/list r/results: list CTS results currently present in the repository
Add:
add derivedplan --plan plane_name --session/-s session_id-r [pass/fail/notExecuted/timeout]: derive a plan from the given session
Dump:
d/dump l/logs: dump the tradefed logsfor all running invocations
Options:
--disable-reboot: Do not reboot device after running some amount of tests. run cts --plan + <plan name> 运行某个plan,查看当前支持的plan,运行l p,实际上所有的plan存放在android-cts/repository/plans; run cts --package/-p 运行某一个测试包; run cts --class/-c [--method/-m] 运行某一个测试类或测试方法; run cts --continue-session session_ID 继续运行之前没有完成的CTS测试,要知道它的session_ID; run cts [options] --serial/s device_ID 在某个串号的设备上进行CTS测试,对应多个机器的时候,通过adb devices能够查看当前连接的所有设备的串号; run cts [options] --shards number_of_shards 在多个设备上同时运行CTS测试,如run cts --plan CTS --shards 2,在两个设备上同时运行; run cts --help/--help-all 展示更多帮助
查看列表: 查看行为是l/list,接不同的参数显示对应信息。 d/devices 当前连接的设备,效果同adb devices,不过信息更详细,还有设备电量信息; packages 当前CTS plan的所有测试包; p/plan 当前所支持的CTS plan有哪些; i/invocations 当前CTS的运行状态; c/commands 展示出用户输入过的命令; r/results 展示以往的测试结果 Session Pass Fail Not Executed Start time Plan name Device serial(s)
0 17720 239 12 2013.08.24_18.23.23 CTS c8090fe4
1 17907 64 0 2013.09.04_17.51.15 CTS FUSC85YLYPAMRC69
需要特别关注的几点注意事项:
实战演戏:连接两台手机后,进入cts控制台:
run cts --plan CTS --shards 2 两台手机上会同时跑起CTS测试,大概5小时候测试完成,生成测试报告,保存在results下。
|