解决方案

CTS 测试简介

seo靠我 2023-09-22 23:08:11

一、简介... 3

1.      CTS介绍... 3

2.      GTS介绍... 3

3.      CTS  Verifier 介绍... 3

二、  测试流程-CTS环境的搭建... 3

1.  SEO靠我    PC:ubuntu 14.04以上系统... 3

2.      CTS 环境... 3

3.      环境搭建... 4

三、测试流程-CTS 测试... 5

1.      测试前的准备工作..SEO靠我. 5

2.      执行CTS过程应注意的问题... 7

3.      O版本测试命令介绍... 8

4.      特殊情况的处理... 10

5.      生成报告... 10

四、测试流程-GTSSEO靠我 测试... 11

1.      测试前的准备工作... 11

2.      测试命令介绍... 11

3.      特殊情况处理... 11

4.      生成报告... 11

五、测试流程-CTS SEO靠我Verifier测试... 11

六、      工作总结... 11

一、简介

1.       CTSc介绍

CTS:Android的CTS测试,英文为Compatibility Test Suite,意SEO靠我为兼容性测试。只有通过CTS测试的设备才有可能获得Android的商标和享受Android Market的权限;Android的CTS目的与意义:用户在android系统中有更好的用户体验,并且展示aSEO靠我ndroid应用的优越性,使得android开发者更容易编写高质量的andorid程序。

2.       GTS介绍

GMS全称为Google MobileService,即谷歌移动服务。GMS是GooSEO靠我gle开发并推动Android的动力,也是Android系统的灵魂所在。GTS主要是对安卓手机上的GMS应用相关性能测试。

3.       CTS  Verifier 介绍

CTS verifier保证SEO靠我应用程序的可靠运行和用户有一个很好的体验,相对CTS和GTS 最大的不同是verifier 不能自动化测试,只能手工测试。

二、  测试流程-CTS环境的搭建

1.     PC:ubuntu 14.04SEO靠我以上系统

最低要求安装ubuntu 14.04以上系统,目前在用的Ubuntu 16.04、 Ubuntu 14.04系统,保证系统和电脑都可以正常使用。

2.     CTS 环境

android 8.0SEO靠我的CTS 环境为

CTS_8.0_r5(4500653)

GTS _5.1_r2(4507047)

Verifier 8.0_r54(0)

下载地址:

http://source.android.com/comSEO靠我patibility/downloads.html

将以上文件下载并拷贝到Ubuntu 系统home的CTS文件夹中并解压即可,并给可执行权限,具体下载页面见下图:

3.     环境搭建

N的环境需要SDSEO靠我K为26以上,下载地址:http://www.android-studio.org/

JDK要求在1.8以上,下载地址:https://www.oracle.com/index.html

环境配置方法:

1SEO靠我. sudo  gedit /etc/profile

在里面添加如下配置:

///SDK配置

#set path for androidsdk tools

export PATH=$PATH:/your_anSEO靠我droid-sdk-linux_path/tools

exportPATH=$PATH:/your_android-sdk-linux_path/platform-tools

exportPATH=$PASEO靠我TH:/your_android-sdk-linux_path/ build-tools /26.0.0

//JDK配置

#set path forandroid jdk tools

exportJAVA_SEO靠我HOME= your_ jdk-linux_path

export JRE_HOME=${JAVA_HOME}/jre

exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HSEO靠我OME}/lib

exportPATH=${JAVA_HOME}/bin:$PATH

环境配置好后输入 java –version 得到

java version"1.8.0_131"

Java(TM) SESEO靠我 RuntimeEnvironment (build 1.8.0_131-b11)

Java HotSpot(TM)64-Bit Server VM (build 25.131-b11, mixed mSEO靠我ode)

输入aapt version得到

Android AssetPackaging Tool, v0.2-4062713

得到上面的结果,CTS的测试环境就配置好了,CTS就可以正常执行了。

JDK和SSEO靠我DK也有其他配置方法,可以自行学习试验。

三、测试流程-CTS 测试

1.   测试前的准备工作

1.Factory data reset thedevice: Settings > Backup & resSEO靠我et > Factory data reset,只要在刷机时选择删除 usrdate

Warning: Thiswill erase all user data from the device.

2.SetSEO靠我 your devices language toEnglish (United States) from: Settings > Language & input> Language

3.Turn onSEO靠我 the location setting ifthere is a GPS or Wi-Fi / Cellular network feature on the device:Settings> LSEO靠我ocation > On

4.Connect to a Wi-Fi network thatsupports IPv6, can treat the Device Under Test (DUT) asSEO靠我 an isolatedclient (see the Physical Environment sectionabove), and has an internet connection:SettiSEO靠我ngs > Wi-Fi

5.Make sure no lock pattern orpassword is set on the device: Settings > Security > Screen SEO靠我lock> None

6.Enable USB debugging onyour device: Settings > Developer options > USB debugging.

Note:OnAndSEO靠我roid 4.2 and later,Developer options is hidden by default.To make them available, go to Settings > AboSEO靠我ut phone andtap Build number seven times. Return to the previous screen tofind Developer options. See EnSEO靠我ablingOn-device Developer Options for additional details.

7.Make sure the time is set to12-hour formaSEO靠我t:Settings > Date & time > Use 24-hour format> Off

8.Select: Settings >Developer options > Stay Awake SEO靠我> On

9.Select: Settings >Developer options > Allow mock locations > On

Note:Thismock locations setting SEO靠我is applicable only in Android 5.x and 4.4.x.

10.Select: Settings >Developer options > Verify apps overSEO靠我 USB > Off

Note: Thisverify apps step became required in Android 4.2.

11.Launch the browser and dismissSEO靠我any startup/setup screen.

12.Connect the desktop machinethat will be used to test the device with a USEO靠我SB cable

Note:Whenyou connect a device running Android 4.2.2 or later to your computer, thesystem shoSEO靠我ws a dialog asking whether to accept an RSA key that allows debuggingthrough this computer. Select ASEO靠我llow USB debugging.

13.Install and configure helperapps on the device.

Note:

For CTSversions 2.1 R2 thrSEO靠我ough 4.2 R4, set up your device (or emulator) to run theaccessibility tests with:

adbinstall -randroiSEO靠我d-cts/repository/testcases/CtsDelegatingAccessibilityService.apkOn the device, enable: Settings > AccSEO靠我essibility > Accessibility> Delegating Accessibility Service

Note:For CTSversions prior to 7.0, on deSEO靠我vices that declareandroid.software.device_admin

, set up yourdevice to run the device administration SEO靠我test using:

adbinstall -r android-cts/repository/testcases/CtsDeviceAdmin.apk

In Settings > Security >SEO靠我 Select device administrators,enable the twoandroid.deviceadmin.cts.CtsDeviceAdminReceiver* device aSEO靠我dministrators. Ensure theandroid.deviceadmin.cts.CtsDeviceAdminDeactivatedReceiver and any other preSEO靠我loaded device administrators remaindisabled.

14.Copy the CTS media files to thedevice as follows:

NoteSEO靠我:For CTS2.3 R12 and later, if the device supports video codecs, the CTS media filesmust be copied toSEO靠我 the device.

·                            Navigate (cd) to the path themedia files are downloaded andSEO靠我 unzipped to.

·                            Change the file permissions: chmod u+xcopy_media.sh

·      SEO靠我                      Run copy_media.sh:

·                                                    To copySEO靠我 clips up to aresolution of 720x480, run: ./copy_media.sh 720x480

·                                  SEO靠我                  If you are not sure about themaximum resolution, try ./copy_media.sh all sothat alSEO靠我l files are copied.

·                                                    If there are multiple deviceSEO靠我sunder adb, add the -s (serial) option to the end. For example, to copy up to720x480 to the device wSEO靠我ith serial 1234567, run: ./copy_media.sh720x480 -s 1234567

15. If the DUT supports the Bluetooth LEfeSEO靠我ature, then at least three Bluetooth LE beacons should be placed within fivemeters of the DUT for BlSEO靠我uetooth LE scan testing.

详细说明参见:https://source.android.com/compatibility/cts/setup

2.   执行CTS过程应注意的问题

1SEO靠我.每次测试最少连接一台手机,目前androidO要求至少4台

2.开始测试前需要点击home键,将手机屏幕放到home界面进行测试。

3.测试中的设备需要放置在一个平稳的桌面上,不允许测试cts的同时,测SEO靠我试其他任务,在测试过程中不允许碰动,防止senor相关的casefail,camera要指向一个物体,用于聚焦。

4.在测试过程中不允许点击任何按键和屏幕,否则可能会导致测试fail。

5.通过启动解压包SEO靠我下的/android-cts/tools/cts-tradefed,启动cts环境。

6.如果设备同时支持arm和x86,需要同时测相关的cts测试包。

详细说明参见:https://source.andSEO靠我roid.com/compatibility/cts/run

3.   O版本测试命令介绍

在控制台输入“?”,会显示我们常用的android O版本cts命令,如上图。和N版本相比,在我们常用的CTS命SEO靠我令中,O的命令几乎没有变化。

1)CTS全包执行命令:runcts --shards  手机数量

2)单跑module:runcts -m <module>: run a test module.

3)单跑SEO靠我某条case:runcts -m <module>  -t <test_name>:run a specific test from the module. Test name can be<packSEO靠我age>.<class>, <package>.<class>#<method> or<native_name>.

如上图,单跑caes的命令可以为:

run cts –m CtsAccelerationSEO靠我TestCases  -t android.acceleration.cts.HardwareAccelerationTest#testIsHardwareAccelerated

4)处理fail项或者SEO靠我continue命令:run cts –retry/-r <session_id>: run all failed tests from aprevious session.

5)List命令不变:l SEO靠我d查看设备状态;l r查看报告

6)其他可选条件:-s+设备SN号;--abi+arm64-v8a/armeabi-v7a;--shards+手机数量(暂时和手机数量一致);--skip-precondSEO靠我itions/-o

--serial/-s <device_id>: The device to run the test on.

--abi/-a <abi>: The ABI torun the teSEO靠我st against.

--shards <shards>: Shards arun into the given number of independant chunks, to run on mulSEO靠我tiple devices inparallel.

7)新增3条抓log的命令,作为可选项,可以放在执行命令的后面。

--logcat-on-failure: Capture logcat when a SEO靠我test fails.

  --bugreport-on-failure: Capture abugreport when a test fails.

--screenshot-on-failure: CapSEO靠我ture ascreenshot when a test fails.、

8)有时为了加快retry的速度,可以过滤一些特殊的测试Module,命令为在cts的run命令后加--exclude-filtSEO靠我er 例如:run cts –r 0 --exclude-filterCtsDeqpTestCases。

AOSP版本run cts的命令为:run cts-reference-aosp 其他和正常版本SEO靠我CTS一样。

其他具体命令可以在CTS环境输入:run cts--help-all查看

其他用法参见谷歌文档:《CTS V2 - Best Practices》

4.   特殊情况的处理

详见给大家发的ExcSEO靠我el文档

5.   生成报告

正常测试过程中最好不要手动生成报告,容易引起测试异常,在需要的情况下,可以用下列方式生成报告:

1.从PC端断掉所有设备,等待测试环境自动生成报告。

2.在控制台输入q或者exiSEO靠我t,然后再输入kill,这样可以快速生成报告。

3.AOSP版本生成报告和正常版本一样,最后提交google需要制作processed报告,具体命令如下:

./process_report.py -finSEO靠我gerprint FP信息 ProductID CTS_Report_path/2017.08.02_10.02.30.zip

这样就会在相关的路径生成processed压缩包,CTS_Report_pSEO靠我ath/2017.08.02_10.02.30_processed.zip

其中,process_report.py为VTS/bin目录下的python脚本。(*8.0_R1由于VTS自带的该脚本有问题SEO靠我,所以需要暂时用Google指定的process_report.py)

FP 必须和测试报告里的fingerprint一样。

四、测试流程-GTS 测试

1.     测试前的准备工作

和CTS相比GTS设置SEO靠我唯一的不同就是不需要将“android-cts-media-1.3”中的test文件夹拷贝到手机根目录下。

2.      测试命令介绍

GTS命令和CTS命令大致相同,androidO版本的GTS命令为SEO靠我

run gts –s 设备SN号。其他和CTS类似。

3.     特殊情况处理

详见给大家发的Excel文档。

4.     生成报告

和CTS类似。

五、测试流程-CTS Verifier测试

详见CTSVSEO靠我erifier_8.0测试文档。

六、 工作总结

1.       CTS 测试尽量在晚上执行,因为耗时比较长,避免耽误白天的时间;在测试前务必确认清楚电池的电量、USB的连接等。

2.       GTSSEO靠我 和verifier尽量在白天执行,特别测试GTS 的时候,一定要在网络状况比较好的情况下测试,避免因网络问题导致测试fail,需要多次测试。

3.       Result中的测试结果尽量及时清理,避SEO靠我免报告太多影响CTS 测试。

4.       电脑在长时间测试CTS 后,尽量的规律性的重启下电脑,避免因PC性能影响CTS测试。

“SEO靠我”的新闻页面文章、图片、音频、视频等稿件均为自媒体人、第三方机构发布或转载。如稿件涉及版权等问题,请与 我们联系删除或处理,客服邮箱:html5sh@163.com,稿件内容仅为传递更多信息之目的,不代表本网观点,亦不代表本网站赞同 其观点或证实其内容的真实性。

网站备案号:浙ICP备17034767号-2