運作CTS測試需要做的準備工作有有:
a.在現有代碼上編譯,代碼版本與目标機器版本一緻;
CTS Media Files
These media files are required for the CTS media stress tests.
CTS Media 1.0
android-cts/repository/testcases中的CtsDelegatingAccessibilityService.apk和CtsDeviceAdmin.apk
安裝完成以上apk後,在手機端操作:
a.設定->輔助程式->Delegating Accessibility Service,打開;
b.設定->安全->裝置管理器->CTS相關的兩個選項都激活;
c.打開USB調試模式;
d.保持螢幕喚醒;
e.允許模仿位置;
f.切換至英文模式US。
執行android-cts/tools/cts-tradefed
<code></code>
<a href="mailto:dev@linux-dev:~/android/CTS/android-cts/tools%24" target="_blank">dev@linux-dev:~/android/CTS/android-cts/tools$</a>
./cts-tradefed
09-0509:20:52
I/: Detectednew device c8090fe4
I/: Detectednew device
5348300e
Android CTS 4.2_r1
我現在連接配接着兩台裝置,都檢測到了。
首先,在控制台中輸入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
首先,手機的功能一定要完整,WIFI BT 3G CAMERA等;
手機要切換至英文語言;
連接配接到可用WIFI;
有SIM卡,并能夠打電話發短信;
對于螢幕密度,目前CTS中最高支援320,但實際上Google已經添加了對480,也就是1080p的支援;
會檢測Fingerprint,注意廠家名;
實戰演戲:
連接配接兩台手機後,進入cts控制台:
run cts --plan CTS --shards 2
兩台手機上會同時跑起CTS測試,大概5小時候測試完成,生成測試報告,儲存在results下。
轉自:http://blog.csdn.net/airk000/article/details/11113391
其他相關資源:
http://www.cnblogs.com/yyangblog/archive/2011/02/16/1955665.html