Android CTS测试

CTS是Google为确保Android设备兼容性而设立的测试套件,通过测试的设备能获得Android商标并进入Android Market。测试包括应用程序兼容性、设备管理器等,测试包可在Android官网下载。在Ubuntu环境下搭建好Android开发环境,安装测试APK后,使用cts-tf工具运行特定测试类,如SSLSocketTest。注意某些失败可能由系统本身问题引起。
摘要由CSDN通过智能技术生成

一什么是CTS

CTS简介:Compatibility Test suite系列兼容测试
google定义了一个兼容性规范(Compatible Definition),而CTS就是为了确保某个测试符合该规范。从而基于Android的应用程序能在基于同一个api版本的设备上面运行。通过CTS测试的device可以获得android的商标,并且享受android market的权限。

例如手机、平板电脑、车载娱乐系统;严格来说需要下载第三方应用的Android系统都要通过CTS测试,才能达到兼容性。

CTS的测试包可以到:http://source.android.com/compatibility/downloads.html去下载,选择对应Android版本的CDD文档(介绍CTS测试),CTS测试包下载(测试包会不断更新),如:android-cts-verifier-4.0.3_r1-linux_x86-arm.zip,android-cts-media-1.0.zip;将下载的CTS测试包解压到相应文件夹里面应包含:android-cts文件夹里面包含Docs、Repository、Tools三个文件夹。需要配置好SDK相关的环境变量,最好是在Ubuntu下进行,搭建好Android的开发环境就可以了。关于环境变量如何配置可以去找下相关的资料。

测试前需要安装apk:adb install android-cts/repository/testcases/CtsDeviceAdmin.apk

会在系统设置-》安全-》设备管理器中生成下图,把这三项选中

二、运行CTS

aaa@aaa-All-Series:~/D/android-cts-4.4_r3-linux_x86-arm/android-cts/tools$ ls
cts-tradefed  cts-tradefed.jar  ddmlib-prebuilt.jar  hosttestlib.jar  junit.jar  README  tradefed-prebuilt.jar
首先在android-cts-4.4_r3-linux_x86-arm/android-cts/tools目录下运行./cts-tradefed
如果没有运行权限需要执行chmod 777 cts-tradefed
aaa@aaa-All-Series:~/D/android-cts-4.4_r3-linux_x86-arm/android-cts/tools$ ./cts-tradefed
此时会出现
cts-tf >
cts-tf > run cts --help
'cts' configuration: Runs a CTS plan from a pre-existing CTS installation

Printing help for only the important options. To see help for all options, use the --help-all flag

  cmd_options options:
    --[no-]help          display the help text for the most important/critical options. Default: false.
    --[no-]help-all      display the full help text for all options. Default: false.
    --[no-]dry-run       build but don't actually run the command.  Intended as a quick check to ensure that a command is runnable. Default: false.
    --[no-]noisy-dry-run build but don't actually run the command.  This version prints the command to the console.  Intended for cmdfile debugging. Default: false.
    --[no-]loop          keep running continuously. Default: false.

  test options:
    --plan               the test plan to run.
    -p, --package        the test packages(s) to run.
    -c, --class          run a specific test class.
    -m, --method         run a specific test method, from given --class.
    --continue-session   continue a previous test session.

  'file' logger options:
    -l, --log-level-display
                         the minimum log level to display on stdout. Default: ERROR. Valid values: [VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT]
eg:
执行一个类

cts-tf > run cts --class libcore.javax.net.ssl.SSLSocketTest

测试gts包需要运行在:gts-1.5_r2/android-xts/tools目录下

xts-tf > run xts --class com.go

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值