搜档网
当前位置:搜档网 › CTS测试总结

CTS测试总结

CTS测试总结
CTS测试总结

CTS测试总结

一、测试前的准备(环境搭建)

下载CTS工具

(1)下载google发布的CTS工具(一般采用此种方法)

下载路径为:https://www.sodocs.net/doc/2911003878.html,/compatibility/downloads.html

根据需要下载不同的版本。

(2)下载编译源码获取CTS工具

在linux下进入android源码根目录,输入以下命令

source build/envsetup.sh

make cts

编译好的cts生成的文件位于:out/host/linux-86/下。

(3)下载相对应的sdk工具

2 .配置startcts文件

进入android-cts/tools目录下,修改startcts文件。将脚本中的SDK_ROOT改成自己的android SDK路径,如:

SDK_ROOT=/home/test/CTS/SDK

3.在设备上安装CtsDelegatingAccessibilityService.apk

此apk位于android-cts/repository/testcases下,

如下安装:adb install -r CtsDelegatingAccessibilityService.apk。

安装好后设置:Settings > Accessibility > Accessibility > Delegating Accessibility Service

4.为了避免没必要的错误,需要做一些设置,具体情况不一样:(具体在后面)

二、执行测试

执行startcts脚本。

在执行CTS测试计划时(执行一段时间后,大于5分钟)会出

现没有足够权限启动devices,使用$sudo./startcts可解决该问题

出现如下提示符表示启动cts并连接设备成功。(红色部分未deviceID,视设备号而定)AndroidCTS version 2.1_r2

Device(CB511KADGR)connected

cts_host> cts_host >

在“cts_host>”提示符下输入命令,以下为几个常用的命令

help查看所有

exit退出

ls-p列出所有的测试包

ls--plan列出所有的测试方案

start--plan plan_name运行一个测试方案,如:start--plan CTS

start--plan plan_name -p package_name//运行一个特定的测试包,如:start--plan CTS -p android.bluetooth

start --plan CTS -t android.app.cts.AlertDialogTest#testAlertDialog

//只运行某个用例包中的某个用例

三、查看测试报告

运行测试时,在CTS运行界面能看到测试报告与运行状况。测试完成后可在/CTS/android-cts-2.2_r3/repository/results/下生成详细的测试报告和一些附加信息,其中用日期和时间命名的文件夹下为所有的测试结果,同时文件夹也会被打成一个对应的.zip包方便提交。用浏览器打开.xml文件(默认就是,直接双击)就可以查看所用的测试报告了

常见问题:

a)问题描述:在执行paln时,执行一段时间后会抛异常,异常如下:

CTS_INFO>>>Restartingdevice...Device(HC09MPL00037)disconnectedExceptioninthread "Thread-17" com.android.ddmlib.AdbCommandRejectedException:insufficientpermissions for device

atcom.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:736)

atcom.android.ddmlib.SyncService.openSync(SyncService.java:164)

atcom.android.ddmlib.Device.getSyncService(Device.java:253)

at com.android.cts.DeviceManager$DeviceServiceMonitor.run(DeviceManager.java:217)

解决方案:是因为权限不够,提升至root权限可解决,命令如下$sudo./startcts

b)问题描述:输入./adbshell出现如下异常:

error:insufficient permissions for device

解决方案:输入:

$sudo-s

./adbkill-server

./adbdevices

c)问题描述:error:device not found。

解决方法:

(1)请确认你的设备是否连接电脑,

(2)以连接PC,重新拔下来,再连一次

(3)如果2操作后还不行,看下USB连接方式是否为默认(仅充电),选htc或USB连接。

d)写入测试结果时报Toomany open files的错误,这是因为网络请求过多,也就导致了系统打开的文件过多。每一个连接都会当成“文件”看待的。

解决方案:用ulimit–a命令查看每个用户允许打开的最大文件数,看到是的1024,把它改大点,用命令:ulimit-n 4096

四、补充说明:

为了避免一些没必要的错误,在测试前先更改一下设备设置:

Make sure the”Wi-Fi” development option is checked(Settings->Wireless and network->Wi-Fi). Make sure the “Wi-Fi” is connected (Settings->Wireless and network->Wi-Fi settings).

Make sure “Bluetooth” development option is checked(Settings->Wireless and network->Bluetooth).

Make sure the”Wi-Fi sleep policy”is set to “Never”(Settings->Wireless and network->Wi-Fi settings->Menu->Advanced->Wi-Fi sleep policy).

Make sure the "Screen Timeout" is set to "Never "or “The max time of time out”(Setting->Display settings->Screen timeout).

Check "Stay A wake", "Allow mock locations" and "User Debugging" from Settings->Application->Development

Make sure "Use wireless networks " development option is checked (Settings->Location and security->Use wireless networks ).

Set the language to English(Settings->Locale and text-Select language).

Copy the “svox” file to the device,make sure the “English(United States)”and “English (United Kingdom)”has been Installed.(Setting s->V oice input and output settings->Text-to-speech settings->Pico TTs)

Install CtsDelegatingAccessibilityService.apk, then the “Accessibility” and” Delegating Accessibility Service” development options are checked (Settings->Accessibility->Delegating Accessibility Service)

Set the Date and Time.(Settings -> Date&time ->Set date / Set time),set the “Select time zone” to “Beijing”(Setting->Select time zone).

Clear browser cache and history (Internet->Menu->Settings)

SD card and have enough space and copy smaple audio and video media files

Make sure no lock pattern is set on the device.

Make sure the device is at the home screen at the start of CTS (Press the home button).

Do not press any keys on the device while CTS is running.

Click the voice Recorder application,to record and save.

Make sure My location is Located on “Maps”

Make sure “turn off USB”

相关主题