简介:

Android兼容性测试(CTS)和连带的兼容性定义文档(CDD),是一个确保终端设备与特定版本Android(比如4.0, 4.1, 4.2, 4.3, 4.4)兼容的自管理程序。CTS测试集包含大约24,000个在Android设备上运行的测试用例,

这些用例分别针对电话、图形、相机、GPS、触摸 屏、无线网等功能。Google针对每个主要Android版本公布了CDD文档,其中指出了对CTS中每类测试的具体要求。

每当我们基于新版本的Android系统适配ROM后,都要对系统进行完整的CTS测试,在我们适配ROM的时候难免会对Android 系统API进行改动,某些改动则会导致输出的结果与预期不一致,最终导致CTS测试不能通过,

于是在发布新机器之前,公司总是将CTS放到最高优先级,但是运行Android CTS的学习代价相对较高,其本身操作实在是令每一个修复CTS bug的工程师疯狂。

为了减少运行CTS 测试case的学习代价,编写的qcts供修复CTS bug的工程师和测试人员使用。

目标:

1.尽量保持运行现有CTS测试case方法的完整性,在这个基础之上,能够帮助使用者更加快速的运行CTS测试case。

2.不需要在终端中疯狂的来回切换Android CTS测试case目录,使切换目录更方便。

3.尽量减少使用者记忆复杂的运行case的命令。

4.我们的共同目标就是:没有蛀牙(^-^)

配置环境:

第一步: 将qcts clone到本机目录下

git clone https://github.com/lmh516/qcts.git

提醒: 如果已经clone过了,下次进入的时候尽量运行:git pull拉取更新

第二步: 进入qcts工程目录运行命令

. build/envsetup.sh

快速使用:

在clone完整个工程使用命令“. build/envsetup.sh”之后,你就可以快速开始CTS之旅了:

  1. 首先,选择当前想要进行CTS测试的android系统版本,只需要运行: lunch
    如果忘记了当前lunch的android版本号运行 version 命令就可以查看

  2. 然后,选择CTS测试模式,只需要运行:mode
    目前支持两种模式: normal模式和debug模式
    1). normal模式: 主要是测试人员使用,选择这个模式跟运行cts-tradefed命令得到的效果一样,进入到cts-tradefed模式之后使用对应cts-tradefed模式的命令即可测试对应的case.
    cts-tradefed模式如下所示,想要进入这个模式出了通过运行mode命令进行选择以外,还可以通过直接运行命令 normal cts-tradefed 进入:

    Android CTS 4.4_r1

    12-16 16:01:26 I/: Detected new device b1bc8ea9

    cts-tf > run cts --plan CTS // 这条命令用于测试整个Android 整个CTS测试计划,同样可以使用命令 cplans 便可以进入到对应的测试计划目,然后录查看到对应的测试计划。

    cts-tf > help // 进入到cts-tradefed模式之后使用help命令即可获取更多测试命令。

    2). debug模式:主要是调试CTS问题的工程师选用,其使用方法非常简单,可以通过输入mode命令选择debug之后输入对应的测试函数; 或者是直接输入命令:debug $className#$funcName
    Example: debug $className#$funcName

    注意:$className是待测试类名,$funcName是待测试函数名称,一定不要忘记输入中间的#, 这个一般从测试fail项中直接复制粘贴过来就可以了. ep:debug android.hardware.cts.CameraTest#testFocusDistances

  3. 小技巧:
    clogs 命令可以快速查看log
    cresults 命令可以快速查看测试结果
    更多方便的命令请运行help命令查看

cts-tradefed模式命令:

CTS-tradefed is the test harness for running the Android Compatibility Suite, built on top of the tradefed framework.

Available commands and options

Host:

help: show this message

help all: show the complete tradefed help

exit: gracefully exit the cts console, waiting till all invocations are complete

Run:

run cts --plan test_plan_name: run a test plan

run cts --package/-p : run a CTS test package

run cts --class/-c [--method/-m] : run a specific test class and/ormethod

run cts --continue-session session_ID: run all not executed tests from a previous CTS session

run cts [options] --serial/s device_ID: run CTS on specified device

run cts [options] --shards number_of_shards: shard a CTS run into given number of independent chunks, to run on multiple devices inparallel

run cts --help/--help-all: get more help on running CTS

List:

l/list d/devices: list connected devices and their state

l/list packages: list CTS test packages

l/list p/plans: list CTS test plans

l/list i/invocations: list invocations aka CTS test runs currentlyin progress

l/list c/commands: list commands: aka CTS test run commands currently in the queue waiting to be allocated devices

l/list r/results: list CTS results currently present in the repository

Add:

add derivedplan --plan plane_name --session/-s session_id -r [pass/fail/notExecuted/timeout]: derive a plan from the given session

Dump:

d/dump l/logs: dump the tradefed logs for all running invocations

Options:

--disable-reboot : Do not reboot device after running some amount of tests.

qcts命令:

Invoke ". build/envsetup.sh" from your shell to add the following commands to your environment:

normal commands:

- help: get the help informations about qcts.

- version: show the current lunch version of android.

- lunch: pick the version of android.

- mode [normal | debug]: pick the mode of cts will be running.

- normal: enter cts-tardefed mode running cts test cases.

- debug [<className#method>]: enter debug mode running cts test cases.

- cts-tradefed: enter cts-tradefed mode, as same as android cts-tradefed script.

- croot: changes directory to the top of the tree.

- ccases: changes directory to the cts testcases of the tree.

- cverifier: changes directory to the cts verifier of the tree.

- ctools: changes directory to the cts tools of the tree.

- clogs: changes directory to the cts logs of the tree.

- cplans: changes directory to the cts plans of the tree.

- cresults: changes directory to the cts results of the tree.

advanced commands:

- install_base: install the base applications of debug mode.

- run <className#method> <runner>: running cts test case in debug mode.

- adb_install_r <apk>: enforce to install an application use adb.




更多相关文章

  1. android中的测试
  2. Android USB下的Accessory模式
  3. 5个最佳的Android测试框架(带示例)
  4. Android测试方法总结汇总
  5. Android与设计模式浅谈
  6. 腾讯优测优分享 | Android性能测试工具化实现
  7. android usb主从设备模式解析,网络连接调试方法

随机推荐

  1. js实现简单好玩的气泡
  2. 鞋子怎么画?各种角度鞋子的绘画教程!
  3. 拖动的页面 滚动导航固定上方
  4. 一个可编辑的表格 双击进行编辑,回车确认
  5. Qwery - 多用途企业商务网站模板WordPres
  6. 意派Epub360丨双12营销H5怎么制作?创意是
  7. 监控云服务器是否正常工作——TCPing命令
  8. JavaScript制作日历
  9. 如何在 Ubuntu 20.04 上添加交换空间
  10. 如何画好动漫人物构图?2人到36人的环状构