最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

Android CTS调研报告

来源:动视网 责编:小OO 时间:2025-10-01 21:01:55
文档

Android CTS调研报告

AndroidCTS调研报告目录版本历史41AndroidCTS简介52为什么需要兼容性测试53CTS工作原理54CTS工作流程55基本概念65.1测试用例的类型65.2测试覆盖65.2.1Android4.0.375.2.2Android2.285.2.3TestPlanVsTestPackagesMappingtable86测试环境配置136.1安装Ubuntu虚拟机136.2下载android-SDKlinux136.3下载android-cts包,下载地址:146.4下载JDKandI
推荐度:
导读AndroidCTS调研报告目录版本历史41AndroidCTS简介52为什么需要兼容性测试53CTS工作原理54CTS工作流程55基本概念65.1测试用例的类型65.2测试覆盖65.2.1Android4.0.375.2.2Android2.285.2.3TestPlanVsTestPackagesMappingtable86测试环境配置136.1安装Ubuntu虚拟机136.2下载android-SDKlinux136.3下载android-cts包,下载地址:146.4下载JDKandI
Android CTS 调研报告

目录

版本历史    4

1 Android CTS 简介    5

2 为什么需要兼容性测试    5

3 CTS 工作原理    5

4 CTS 工作流程    5

5 基本概念    6

5.1 测试用例的类型    6

5.2 测试覆盖    6

5.2.1 Android 4.0.3    7

5.2.2 Android 2.2    8

5.2.3 Test Plan Vs Test Packages Mapping table    8

6 测试环境配置    13

6.1 安装Ubuntu 虚拟机    13

6.2 下载android-SDK linux    13

6.3 下载android-cts包,下载地址:    14

6.4 下载JDK and Install    14

6.5 将android-sdk和android-cts解压放置在同一个文件夹    16

6.6 设置环境变量    16

6.7 终端测试前准备    17

     检测手机是否连接上电脑    17

     终端设置:(不同操作系统版本的手机可能菜单顺序稍有不同,但应该都包含下面的选项)    17

6.8 运行测试    18

1  Android CTS 简介

CTS  全称 Compatibility  Test  Suite 兼容性测试工具。当产品开发出来以后,并定制了自己的 Android 系统后,必须要通过最新的 CTS 检测,以保证标准的 Android  Application 能运行在该平台下。通过了 CTS 验证,需要将测试报告提交给 Google,已取得 android market的认证。 CTS 是一款通过命令行操作的工具。目前CTS没有提供 windows 版本,只能在 Linux 下测试。

2 为什么需要兼容性测试

●让APP提供更好的用户体验。用户可以选择更多的适合自己设备的APP。让APP更稳定。

●让开发者设计更高质量的APP。

●充分利用Android market(Google Play Store),  通过CTS的设备可以进入Android market。

3 CTS 工作原理

4 CTS 工作流程

●Download编译好的CTS 从网站http://source.android.com/compatibility/downloads.html

●安装配置CTS

●把手机设备连接到PC上。

●运行CTS。CTS会把相应的测试用例(APK文件)传送到设备上并通过instrumentation运行,然后记录运行结果。

●测试完成以后,删除测试用例。所有的测试用例执行完毕后,可以参照测试结果重新调整或优化系统。然后继续运行CTS测试。

●你可以把CTS生成的结果(就是result下面那个以测试时间命名的.zip文件, xml 和截图)提交给cts@android.com。

5 基本概念

●Test Plan(Plan):测试计划,Test package 的集合,每个 Plan 中都包含若干个测试包 

●Test Package(Package):测试包,Test case的集合 

●Test case:测试用例,Test 的集合 

●Test:测试,每一个测试对应一个或者多个 Instrumentation Test 

●Instrumentation Test:Instrumentation和Activity有点类似,只不过Activity是需要一个界面的,而Instrumentation并不是这样的,我们可以将它理解为一种没有图形界面的,具有启动能力的,用于监控其他类(用Target Package声明)的工具类。

Android 测试环境的核心是一个 Instrumentation 框架,在这个框架下,你的测试应用程序可以精确控制应用程序。使用 Instrumentation,你可以在主程序启动之前,创建模拟的系统对象,如 Context;控制应用程序的多个生命周期;发送 UI 事件给应用程序;在执行期间检查程序状态。Instrumentation 框架通过将主程序和测试程序运行在同一个进程来实现这些功能。关于测试用例 

5.1 测试用例的类型

CTS包含下面三种级别:

●单元级: 测试Android平台上的代码单元。比如,一个java.util.HashMap这样的类。

●功能级: 多个API组合而成的一个更高级的功能。对应CTS的test package

●程序级: 通过运行一个简单的APP来执行一个API集合和Android运行时服务。对应CTS的 test plan

未来版本还会包含下面的类型:

●强度测试: 测试系统在高CPU运算之下的稳定性。

●性能测试: 比如每秒渲染的帧数。

5.2 测试覆盖

目前,为了确保兼容,测试用例覆盖了下面的这些范围.

5.2.1 Android 4.0.3

总共包含8个Test plan, 55 个test package.

●CTS:这些测试用例是检验兼容性必须的.

●CTS-TF: 实际包含的测试包与CTS是相同的, 当测试时,如果输入CTS, 实际上执行的是CTS-TF。更多信息请参考下面的内容。

下面的内容来自http://code.google.com/p/android/issues/detail?id=24507 android4.0 what is the difference between CTS test plan and CTS-TF test plan

There shouldn't be any difference between CTS and CTS-TF plans. I believe the test runner will actually

run CTS-TF if you enter CTS. 

TF stands for Trade Federation which is the new test runner used by CTS. The CTS-TF plan was created

so that TF vm-tests specific enhancements could be made while the old CTS runner was still being used.

There have been some fixes to the vm-tests which did not get back to the CTS plan, but this shouldn't 

matter since the test runner detects when the CTS plan is used and redirects the runner to use the CTS-TF

 plan.

●Signature:包含所有针对公有APIs的署名测试

●Android:包含针对android APIs的所有测试

●Java:包含所有针对Java核心library的测试

●VM-TF:包含对虚拟机的所有测试

●RefApp:包含针对参与应用程序的所有测试,随版本的更新,本测试计划也会更新

●AppSerurity:针对Application安全性的测试

5.2.2 Android 2.2

●CTS:包含2万多个测试用例,这些测试用例是检验兼容性必须的,性能测试不包含在本计划中,随版本的更新,本测试计划也会更新。

●Signature:包含所有针对公有APIs的署名测试

●Android:包含针对android APIs的所有测试

●Java:包含所有针对Java核心library的测试

●VM:包含对虚拟机的所有测试

●RefApp:包含针对参与应用程序的所有测试,随版本的更新,本测试计划也会更新

●Performance:包含所有针对性能的测试,随版本的更新,本测试计划也会更新

●AppSerurity:针对Application安全性的测试

5.2.3 Test Plan Vs Test Packages Mapping table

●CTS: (53)

1android.apidemos.cts

2android.acceleration

3android.accessibilityservice

4android.accounts

5android.admin

6android.animation

7android.app

8android.bluetooth

9android.content

10android.database

11android.dpi

12android.dpi2

13android.drm

14android.example

15android.gesture

16android.graphics2

17android.graphics

18android.hardware

19android.holo

20android.jni

21android.location

22android.mediastress

23android.media

24android.nativemedia

25android.ndef

26android.net

27android.openglperf

28android.os

29android.permission2

30android.permission

31android.preference2

32android.preference

33android.provider

34android.renderscript

35android.sax

36android.security

37android.speech

38android.telephony

39android.text

40android.textureview

41android.util

42android.view

43android.webkit

44android.widget

45android.tests.sigtest

46android.core.tests.libcore.package.com

47android.core.tests.libcore.package.dalvik

48android.core.tests.libcore.package.libcore

49android.core.tests.libcore.package.org

50android.core.tests.libcore.package.sun

51android.core.tests.libcore.package.tests

52android.core.vm-tests-tf

53android.tests.appsecurity

●VM-TF: 

1android.core.vm-tests-tf

●Signature:

1android.tests.sigtest

●Android : (45 package)

1android.apidemos.cts

2android.acceleration

3android.accessibilityservice

4android.accounts

5android.admin

6android.animation

7android.app

8android.bluetooth

9android.content

10android.database

11android.dpi

12android.dpi2

13android.drm

14android.example

15android.gesture

16android.graphics2

17android.graphics

18android.hardware

19android.holo

20android.jni

21android.location

22android.mediastress

23android.media

24android.nativemedia

25android.ndef

26android.net

27android.openglperf

28android.os

29android.permission2

30android.permission

31android.preference2

32android.preference

33android.provider

34android.renderscript

35android.sax

36android.security

37android.speech

38android.telephony

39android.text

40android.textureview

41android.util

42android.view

43android.webkit

44android.widget

45android.tests.appsecurity

●AppSecurity

1android.tests.appsecurity

●Java(6)

1android.core.tests.libcore.package.com

2android.core.tests.libcore.package.dalvik

3android.core.tests.libcore.package.libcore

4android.core.tests.libcore.package.org

5  android.core.tests.libcore.package.sun

6  android.core.tests.libcore.package.tests

●RefApp

7android.apidemos.cts

下面的信息来自用户手册

●Signature

对每个Android产品,都有一些XML文件来描述所有的公开API。CTS包含了一个工具来检测这些API签名中包含的API是否都在系统中被支持。

For each Android release, there are XML files describing the signatures of all public APIs contained in the release. The CTS contains a utility to check those API signatures against the APIs available on the device. The results from signature checking are recorded in the test result XML file.

●Platform API 

测试SDK文档中描述的平台API,比如core libraries,Android Application Framework等。要求这些API可以提供:正确的类、属性、方法签名、方法行为、错误参数处理方式

Test the platform (core libraries and Android Application

Framework) APIs as documented in the SDK Class Index to ensure

API correctness:

• correct class, attribute and method signatures

• correct method behavior

• negative tests to ensure expected behavior for incorrect parameter handling

●Dalvik VM

专门针对Dalvik Vm的测试。\

The tests focus on testing the Dalvik VM

●Platform Data Model

平台通过ContentProvider提供给开发者使用的数据,比如:Contacts,Browser,Settings等。

The CTS tests the core platform data model as exposed to

application developers through content providers, as documented in

the SDK android.provider package:

• contacts

• browser

Google Confidential

• settings

• more...

●Platform Intents

平台提供的用于核心功能的Intent。

The CTS tests the core platform intents, as documented in the SDKAvailable Intents.

●Platform permission

平台提供的一些重要APP权限

The CTS tests the core platform permissions, as documented in the SDK Available Permissions.

●Platform Resources

平台提供的一些重要的resource type

6 测试环境配置

6.1 安装Ubuntu 虚拟机

http://www.startos.com/ubuntu/guide/201010277752.html

6.2 下载android-SDK linux

http://developer.android.com/sdk/index.html

NOTES:

如果你运行的android-cts 2.2 或者更早的版本, SDK需要安装android-sdk_r06-linux_86版本,否则测试不能正常进行。你能从下面的download r6版本。

http://ishare.iask.sina.com.cn/f/9796963.html

6.3 下载android-cts包,下载地址:

http://source.android.com/compatibility/downloads.html

根据手机系统版本下载对应版本的cts包,否则将无法运行测试

6.4 下载JDK and Install

http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html

1.创建安装目录,在/usr/java下建立安装路径,并将文件考到该路径下: 

$ mkdir /usr/java

2.jdk-6u26-linux-i586.bin 这个是自解压的文件,执行下面的命令

3.$ chmod 755 jdk-6u26-linux-i586.bin 

$ ./jdk-6u26-linux-i586.bin (注意,这个步骤一定要在jdk-6u26-linux-i586.bin所在目录下)

在按提示输入yes后,jdk被解压。稍后出现Do you aggree to the above license terms? [yes or no],输入YES

除此以外,你也可下载jdk-6u26-linux-i586-rpm.bin

若是用jdk-6u26-linux-i586-rpm.bin 这个也是一个自解压文件,不过解压后的文件是jdk-6u26-linux-i586-rpm 包,执行rpm命令装到linux上就可以了。安装如下: 

$ chmod 755 ./jdk-6u26-linux-i586-rpm  

$ ./jdk-6u11-linux-i586-rpm .bin 

$ rpm -ivh jdk-6u11-linux-i586-rpm

6.5 将android-sdk和android-cts解压放置在同一个文件夹

6.6 设置环境变量

进入你的工作目录,比如/home/sxu, 然后编辑文件 .bashrc

$ cd /home/sxu

$ vim .bashrc

添加下面的环境变量根据你自己实际的情况

export JAVA_HOME=/usr/java/jdk1.6.0_26

export JAVA_BIN=/usr/java/jdk1.6.0_26/bin

export PATH=$PATH:$JAVA_HOME/bin:/home/sxu/cts/android-sdk-linux/tools:/home/sxu/cts/android‐sdk‐linux/platform‐tools:/home/sxu/cts/android‐cts/tools:/home/sxu/cts/android-sdk-linux/platform-tools:/home/sxu/cts/android-cts4/tools

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export JAVA_HOME JAVA_BIN PATH CLASSPATH

红色部分是为SDK 和CTS。

保存后,运行下面的命令

$source .bashrc

然后你能运行下面的命令,检查是否上面的命令是否生效

6.7 终端测试前准备

●检测手机是否连接上电脑

打开终端输入命令:adb devices ,连接上这会显示设备ID,如果未连接上则会以???????代替,此时可以通过输入以下命令进行连接

$ adb kill-server

$ sudo adb start-server

$ adb devices

●终端设置:(不同操作系统版本的手机可能菜单顺序稍有不同,但应该都包含下面的选项)

1.语言设置为English 

2.去掉锁屏(Settings > Personal Security > Screen security >screen lock>none )

3.设置屏幕超时为最长时间30分钟(Settings>Device >Display>Screen timeout>30minutes)

4.设置唤醒状态(Settings>Applications>Development>Stay awake)

5.设置虚拟地点(Settings > Application > Development > Allow mock locations is set)

6.运行时让屏幕是home主界面上

7.运行过程中不要触摸屏幕及按钮

8.手机时间设置正确

9.有SD卡并是清空

10.设置USB debugging (Settings > Application > Development >USB debugging)

11.对于全智达手机

12.全智达手机

要copy file 

sxu@sxu-virtual-machine:~/cts/android-sdk-linux/platform-tools$ sudo service udev restart

sxu@sxu-virtual-machine:~/cts/android-sdk-linux/platform-tools$ cp /media/88CD-B201/51-android.rules /etc/udev/

●除此之外,如果是低版本android操作系统(比如2.2 or 2.3),需要安装CtsDelegatingAccessibilityService.apk

此包位于android-cts/repository/testcases下面。可以将安装包拷贝到手机后安装也可通过打开终端输入命令。输入命令方法:先定位到plantform-tools文件夹,cd cts/android-sdk-linux/platform-tools然后再输入安装命令:./adb install /安装包的路径/CtsDelegatingAccessibilityService.apk

安装好后设置进入手机设在菜单:

Setting>Accessibility>Accessibility>DelegatingAccessibilityService

●另外,如果运行2.2版本

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

SDK_ROOT=/home/sxu/cts/android-sdk-linux

6.8 运行测试

●进入CTS 测试环境 

4.0 version

2.2 version

●有效的命令

4.0 version

2.2 version

●运行测试 , 你将看到下面的画面

4.0.3 version

Cts-tf > run cts –plan CTS

2.2 version

注意2.2与2.3版运行次数有,将重启手机,需要更新配置文件

../cts/android-cts2.2/repository/ host_config.xml,更新Value =0 将不重启手机

●测试结果:

所有测试结果将被保存在../android-cts/repository/results/下面,测试报告以开始的日期+时间命名,如2012.08.16_13.06.10, 一般只要查看testresult.xml文件就可对测试结果进行分析, 下面是例子

文档

Android CTS调研报告

AndroidCTS调研报告目录版本历史41AndroidCTS简介52为什么需要兼容性测试53CTS工作原理54CTS工作流程55基本概念65.1测试用例的类型65.2测试覆盖65.2.1Android4.0.375.2.2Android2.285.2.3TestPlanVsTestPackagesMappingtable86测试环境配置136.1安装Ubuntu虚拟机136.2下载android-SDKlinux136.3下载android-cts包,下载地址:146.4下载JDKandI
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top