CTS如何继续上一次测试

来源:互联网 发布:计算机远程控制软件 编辑:程序博客网 时间:2024/05/16 01:22

       在用cts测试安卓系统的时候,由于测试时间较长,会遇到各种各样的问题,导致cts测试中断了。那么cts中断了是不是只能重新测试呢?答案是否定的。

通过运行“./android-cts/tools/cts-tradefed”命令打开cts终端,输入“help”命令就能看到cts支持的命令:

cts-tf > topeet@ubuntu:~/Android_test$ ./android-cts/tools/cts-tradefed Android CTS 4.4_r311-08 14:07:25 I/: Detected new device 0123456789ABCDEFcts-tf > helpCTS-tradefed host version 4.4_r3CTS-tradefed is the test harness for running the Android Compatibility Suite, built on top of the tradefed framework.Available commands and optionsHost:  help: show this message  help all: show the complete tradefed help  exit: gracefully exit the cts console, waiting till all invocations are completeRun:  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 CTSList:  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 repositoryAdd:  add derivedplan --plan plane_name --session/-s session_id -r [pass/fail/notExecuted/timeout]: derive a plan from the given sessionDump:  d/dump l/logs: dump the tradefed logs for all running invocationsOptions:  --disable-reboot : Do not reboot device after running some amount of tests.cts-tf > 
其中的
run cts --continue-session session_ID: run all not executed tests from a previous CTS session
告诉你输入这个命令就能继续上一次未执行完的测试,不过这个命令需要一个”session_ID“,那么 ”session_ID“又是什么,你输入"list results"就能看到以下内容:

cts-tf > l rSession  Pass   Fail  Not Executed  Start time           Plan name  Device serial(s)  0        20556  226   4115          2017.11.05_20.58.29  CTS        unknown           1        24567  330   0             2017.11.06_17.23.22  CTS        unknown  
原来session_ID是你曾经运行过的测试计划,这个测试计划用一个数字表示,我上次测试的日期是“2017.11.05_20.58.29”,故session_ID是0,那么在终端输入
run cts --continue-session 1
就能继续上一次未完成的测试。

测试完毕后会提示你测试结果存放的目录

11-07 21:08:26 I/0123456789ABCDEF: -----------------------------------------11-07 21:08:26 I/0123456789ABCDEF: Test package zzz.android.monkey started11-07 21:08:26 I/0123456789ABCDEF: -----------------------------------------11-07 21:08:32 E/DeviceMonitor: Adb connection Error:EOF11-07 21:08:32 E/DeviceMonitor: Connection attempts: 111-07 21:08:33 E/DeviceMonitor: Connection attempts: 211-07 21:08:34 E/DeviceMonitor: Connection attempts: 311-07 21:08:53 I/0123456789ABCDEF: com.android.cts.monkey.CategoryTest#testDefaultCategories PASS 11-07 21:09:15 I/0123456789ABCDEF: com.android.cts.monkey.CategoryTest#testMultipleCategories PASS 11-07 21:09:50 I/0123456789ABCDEF: com.android.cts.monkey.CategoryTest#testSingleCategory PASS 11-07 21:10:00 I/0123456789ABCDEF: com.android.cts.monkey.MonkeyTest#testIsMonkey PASS 11-07 21:10:08 I/0123456789ABCDEF: com.android.cts.monkey.MonkeyTest#testNotMonkey PASS 11-07 21:10:38 I/0123456789ABCDEF: com.android.cts.monkey.PackageTest#testMultiplePackages PASS 11-07 21:11:13 I/0123456789ABCDEF: com.android.cts.monkey.PackageTest#testSinglePackage PASS 11-07 21:11:27 I/0123456789ABCDEF: com.android.cts.monkey.SeedTest#testSeed PASS 11-07 21:11:41 I/0123456789ABCDEF: com.android.cts.monkey.VerbosityTest#testVerbosity PASS 11-07 21:12:24 I/0123456789ABCDEF: Saved log device_logcat_2650432261313209408.zip11-07 21:12:28 I/0123456789ABCDEF: Saved log host_log_7029118199131048224.zip11-07 21:12:30 I/0123456789ABCDEF: zzz.android.monkey package complete: Passed 9, Failed 0, Not Executed 011-07 21:12:30 I/0123456789ABCDEF: Created xml report file at file:///home/topeet/Android/iTop4412_KK4.4_usbwifi/out/host/linux-x86/cts/android-cts/repository/results/2017.11.06_17.23.22/testResult.xml11-07 21:12:51 I/0123456789ABCDEF: XML test result file generated at 2017.11.06_17.23.22. Passed 24567, Failed 330, Not Executed 011-07 21:12:51 I/0123456789ABCDEF: Time: 0scts-tf >