CTS 测试简介
?
一、簡介... 3
1.????? CTS介紹... 3
2.????? GTS介紹... 3
3.????? CTS? Verifier 介紹... 3
二、? 測試流程-CTS環境的搭建... 3
1.????? PC:ubuntu 14.04以上系統... 3
2.????? CTS 環境... 3
3.????? 環境搭建... 4
三、測試流程-CTS 測試... 5
1.????? 測試前的準備工作... 5
2.????? 執行CTS過程應注意的問題... 7
3.????? O版本測試命令介紹... 8
4.????? 特殊情況的處理... 10
5.????? 生成報告... 10
四、測試流程-GTS 測試... 11
1.????? 測試前的準備工作... 11
2.????? 測試命令介紹... 11
3.????? 特殊情況處理... 11
4.????? 生成報告... 11
五、測試流程-CTS Verifier測試... 11
六、????? 工作總結... 11
?
?
一、簡介
1.?????? CTSc介紹
CTS:Android的CTS測試,英文為Compatibility Test Suite,意為兼容性測試。只有通過CTS測試的設備才有可能獲得Android的商標和享受Android Market的權限;Android的CTS目的與意義:用戶在android系統中有更好的用戶體驗,并且展示android應用的優越性,使得android開發者更容易編寫高質量的andorid程序。
2.?????? GTS介紹
GMS全稱為Google?MobileService,即谷歌移動服務。GMS是Google開發并推動Android的動力,也是Android系統的靈魂所在。GTS主要是對安卓手機上的GMS應用相關性能測試。
3.?????? CTS? Verifier 介紹
CTS verifier保證應用程序的可靠運行和用戶有一個很好的體驗,相對CTS和GTS 最大的不同是verifier 不能自動化測試,只能手工測試。
二、? 測試流程-CTS環境的搭建
1.?????PC:ubuntu 14.04以上系統
最低要求安裝ubuntu 14.04以上系統,目前在用的Ubuntu 16.04、 Ubuntu 14.04系統,保證系統和電腦都可以正常使用。
2.?????CTS 環境
android 8.0的CTS 環境為
CTS_8.0_r5(4500653)
GTS _5.1_r2(4507047)
Verifier 8.0_r54(0)
下載地址:
http://source.android.com/compatibility/downloads.html
將以上文件下載并拷貝到Ubuntu 系統home的CTS文件夾中并解壓即可,并給可執行權限,具體下載頁面見下圖:
?
3.?????環境搭建
N的環境需要SDK為26以上,下載地址:http://www.android-studio.org/
JDK要求在1.8以上,下載地址:https://www.oracle.com/index.html
環境配置方法:
1. sudo ?gedit /etc/profile
在里面添加如下配置:
///SDK配置
#set path for androidsdk tools
export PATH=$PATH:/your_android-sdk-linux_path/tools
exportPATH=$PATH:/your_android-sdk-linux_path/platform-tools
exportPATH=$PATH:/your_android-sdk-linux_path/ build-tools /26.0.0
//JDK配置
#set path forandroid jdk tools
exportJAVA_HOME= your_ jdk-linux_path
export JRE_HOME=${JAVA_HOME}/jre
exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
exportPATH=${JAVA_HOME}/bin:$PATH
?
環境配置好后輸入 java –version 得到
java version"1.8.0_131"
Java(TM) SE RuntimeEnvironment (build 1.8.0_131-b11)
Java HotSpot(TM)64-Bit Server VM (build 25.131-b11, mixed mode)
輸入aapt version得到
Android AssetPackaging Tool, v0.2-4062713
得到上面的結果,CTS的測試環境就配置好了,CTS就可以正常執行了。
JDK和SDK也有其他配置方法,可以自行學習試驗。
三、測試流程-CTS 測試
1.???測試前的準備工作
1.Factory data reset thedevice:?Settings > Backup & reset > Factory data reset,只要在刷機時選擇刪除 usrdate
Warning:?Thiswill erase all user data from the device.
2.Set your device's language toEnglish (United States) from:?Settings > Language & input> Language
3.Turn on the location setting ifthere is a GPS or Wi-Fi / Cellular network feature on the device:?Settings> Location > On
4.Connect to a Wi-Fi network thatsupports IPv6, can treat the Device Under Test (DUT) as an?isolatedclient?(see the?Physical Environment?sectionabove), and has an internet connection:?Settings > Wi-Fi
5.Make sure no lock pattern orpassword is set on the device:?Settings > Security > Screen lock> None
6.Enable?USB debugging?onyour device:?Settings > Developer options > USB debugging.
Note:?OnAndroid 4.2 and later,?Developer options?is hidden by default.To make them available, go to?Settings > About phone?andtap?Build number?seven times. Return to the previous screen tofind?Developer options. See?EnablingOn-device Developer Options?for additional details.
7.Make sure the time is set to12-hour format:?Settings > Date & time > Use 24-hour format> Off
8.Select:?Settings >Developer options > Stay Awake > On
9.Select:?Settings >Developer options > Allow mock locations > On
Note:?Thismock locations setting is applicable only in Android 5.x and 4.4.x.
10.Select:?Settings >Developer options > Verify apps over USB > Off
Note:?Thisverify apps step became required in Android 4.2.
11.Launch the browser and dismissany startup/setup screen.
12.Connect the desktop machinethat will be used to test the device with a USB cable
Note:?Whenyou connect a device running Android 4.2.2 or later to your computer, thesystem shows a dialog asking whether to accept an RSA key that allows debuggingthrough this computer. Select?Allow USB debugging.
13.Install and configure helperapps on the device.
Note:?For CTSversions 2.1 R2 through 4.2 R4, set up your device (or emulator) to run theaccessibility tests with:
adbinstall -randroid-cts/repository/testcases/CtsDelegatingAccessibilityService.apk
On the device, enable:?Settings > Accessibility > Accessibility> Delegating Accessibility Service
Note:?For CTSversions prior to 7.0, on devices that declare?android.software.device_admin, set up yourdevice to run the device administration test using:
adbinstall -r android-cts/repository/testcases/CtsDeviceAdmin.apk
In Settings > Security > Select device administrators,enable the twoandroid.deviceadmin.cts.CtsDeviceAdminReceiver*?device administrators. Ensure theandroid.deviceadmin.cts.CtsDeviceAdminDeactivatedReceiver?and any other preloaded device administrators remaindisabled.
14.Copy the CTS media files to thedevice as follows:
Note:?For CTS2.3 R12 and later, if the device supports video codecs, the CTS media filesmust be copied to the device.
·????????????????????????????Navigate (cd) to the path themedia files are downloaded and unzipped to.
·????????????????????????????Change the file permissions:?chmod u+xcopy_media.sh
·????????????????????????????Run?copy_media.sh:
·????????????????????????????????????????????????????To copy clips up to aresolution of 720x480, run:?./copy_media.sh 720x480
·????????????????????????????????????????????????????If you are not sure about themaximum resolution, try?./copy_media.sh all?sothat all files are copied.
·????????????????????????????????????????????????????If there are multiple devicesunder adb, add the -s (serial) option to the end. For example, to copy up to720x480 to the device with serial 1234567, run:?./copy_media.sh720x480 -s 1234567
15.?If the DUT supports the Bluetooth LEfeature, then at least three Bluetooth LE beacons should be placed within fivemeters of the DUT for Bluetooth LE scan testing.
詳細說明參見:https://source.android.com/compatibility/cts/setup
2.???執行CTS過程應注意的問題
1.每次測試最少連接一臺手機,目前androidO要求至少4臺
2.開始測試前需要點擊home鍵,將手機屏幕放到home界面進行測試。
3.測試中的設備需要放置在一個平穩的桌面上,不允許測試cts的同時,測試其他任務,在測試過程中不允許碰動,防止senor相關的casefail,camera要指向一個物體,用于聚焦。
4.在測試過程中不允許點擊任何按鍵和屏幕,否則可能會導致測試fail。
5.通過啟動解壓包下的/android-cts/tools/cts-tradefed,啟動cts環境。
6.如果設備同時支持arm和x86,需要同時測相關的cts測試包。
詳細說明參見:https://source.android.com/compatibility/cts/run
3.???O版本測試命令介紹
?
在控制臺輸入“?”,會顯示我們常用的android O版本cts命令,如上圖。和N版本相比,在我們常用的CTS命令中,O的命令幾乎沒有變化。
1)CTS全包執行命令:runcts --shards? 手機數量
2)單跑module:runcts -m <module>: run a test module.
3)單跑某條case:runcts -m <module> ?-t <test_name>:run a specific test from the module. Test name can be<package>.<class>, <package>.<class>#<method> or<native_name>.
?
如上圖,單跑caes的命令可以為:
run cts –m CtsAccelerationTestCases? -t android.acceleration.cts.HardwareAccelerationTest#testIsHardwareAccelerated
4)處理fail項或者continue命令:run cts –retry/-r <session_id>: run all failed tests from aprevious session.
5)List命令不變:l d查看設備狀態;l r查看報告
6)其他可選條件:-s+設備SN號;--abi+arm64-v8a/armeabi-v7a;--shards+手機數量(暫時和手機數量一致);--skip-preconditions/-o
--serial/-s <device_id>: The device to run the test on.
? --abi/-a <abi>: The ABI torun the test against.
? --shards <shards>: Shards arun into the given number of independant chunks, to run on multiple devices inparallel.
7)新增3條抓log的命令,作為可選項,可以放在執行命令的后面。
--logcat-on-failure: Capture logcat when a test fails.
? --bugreport-on-failure: Capture abugreport when a test fails.
? --screenshot-on-failure: Capture ascreenshot when a test fails.、
8)有時為了加快retry的速度,可以過濾一些特殊的測試Module,命令為在cts的run命令后加--exclude-filter 例如:run cts –r 0 --exclude-filterCtsDeqpTestCases。
AOSP版本run cts的命令為:run cts-reference-aosp 其他和正常版本CTS一樣。
其他具體命令可以在CTS環境輸入:run cts--help-all查看
其他用法參見谷歌文檔:《CTS V2 - Best Practices》
?
4.???特殊情況的處理
詳見給大家發的Excel文檔
5.???生成報告
正常測試過程中最好不要手動生成報告,容易引起測試異常,在需要的情況下,可以用下列方式生成報告:
1.從PC端斷掉所有設備,等待測試環境自動生成報告。
2.在控制臺輸入q或者exit,然后再輸入kill,這樣可以快速生成報告。
3.AOSP版本生成報告和正常版本一樣,最后提交google需要制作processed報告,具體命令如下:
./process_report.py -fingerprint FP信息 ProductID CTS_Report_path/2017.08.02_10.02.30.zip?
這樣就會在相關的路徑生成processed壓縮包,CTS_Report_path/2017.08.02_10.02.30_processed.zip
其中,process_report.py為VTS/bin目錄下的python腳本。(*8.0_R1由于VTS自帶的該腳本有問題,所以需要暫時用Google指定的process_report.py)
FP 必須和測試報告里的fingerprint一樣。
四、測試流程-GTS 測試
1.?????測試前的準備工作
和CTS相比GTS設置唯一的不同就是不需要將“android-cts-media-1.3”中的test文件夾拷貝到手機根目錄下。
2.??????測試命令介紹
GTS命令和CTS命令大致相同,androidO版本的GTS命令為:
run gts –s 設備SN號。其他和CTS類似。
3.?????特殊情況處理
詳見給大家發的Excel文檔。
4.?????生成報告
和CTS類似。
五、測試流程-CTS Verifier測試
詳見CTSVerifier_8.0測試文檔。
六、 工作總結
1.?????? CTS 測試盡量在晚上執行,因為耗時比較長,避免耽誤白天的時間;在測試前務必確認清楚電池的電量、USB的連接等。
2.?????? GTS 和verifier盡量在白天執行,特別測試GTS 的時候,一定要在網絡狀況比較好的情況下測試,避免因網絡問題導致測試fail,需要多次測試。
3.?????? Result中的測試結果盡量及時清理,避免報告太多影響CTS 測試。
4.?????? 電腦在長時間測試CTS 后,盡量的規律性的重啟下電腦,避免因PC性能影響CTS測試。
總結
- 上一篇: 机器人定位技术 激光SLAM与视觉SLA
- 下一篇: 复试平均分397分!清华大学计算机考研