運行CTS測試須要作的準備工做有有:html
a.在現有代碼上編譯,代碼版本與目標機器版本一致;linux
b.在Google官網下載:http://source.android.com/compatibility/downloads.html,Compatibility Test Suite (CTS)便可。android
CTS Media Files
安全
These media files are required for the CTS media stress tests.
CTS Media 1.0 session
android-cts/repository/testcases中的CtsDelegatingAccessibilityService.apk和CtsDeviceAdmin.apk工具
安裝完成以上apk後,在手機端操做:測試
a.設置->輔助程序->Delegating Accessibility Service,打開;ui
b.設置->安全->設備管理器->CTS相關的兩個選項都激活;this
c.打開USB調試模式;google
d.保持屏幕喚醒;
e.容許模仿位置;
f.切換至英文模式US。
執行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
我如今鏈接着兩臺設備,都檢測到了。
首先,在控制檯中輸入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,注意廠家名;
要保證可以訪問到www.google.com;
實戰演戲:
鏈接兩臺手機後,進入cts控制檯:
run cts --plan CTS --shards 2
兩臺手機上會同時跑起CTS測試,大概5小時候測試完成,生成測試報告,保存在results下。