Android CTS 测试

  CTS 全称(Compatibility Test Suite),兼容性测试工具,GTS全称Google Mobile Services Test Suite,主要用来测试google服务。这里我记录一下自己工作中的经验。
在做CTS之前,要先做到下面几条。

  • 手机手机安全要打开,不要锁定屏幕:设置->安全->屏幕锁定方式-> 设置为“无”
  • 手机不能休眠:
    • 设置->开发人员选项-> 不锁定屏幕 -> 设置为“充电时屏幕不会休眠”
    • USB调试 -> enable
    • 允许模拟位置-> enable

1.Android 7.0 CTS需要注意的地方

  • 1.JDK版本:JDK版本版本要使用jdk1.8,要不然运行CTS会提示,JDK版本过低。
  • 2.使用步骤
    • (1) 下载地址,这是google官方下载地址,里面包含各个版本的CTS包。
    • (2) 下载aapt可执行程序,并将aapt路径加入到环境变量PATH中。
    • (3)在CTS包中运行cts-tradefed可执行程序。
      Android CTS 测试_第1张图片

Android Compatibility Test Suite 7.0_r9 (3943095)
cts-tf > help
Compatibility Test Suite

CTS is the test harness for running the Android Compatibility Suite, built on top of Trade Federation.

Available commands and options
Host:
  help: show this message.
  help all: show the complete tradefed help.
  version: show the version.
  exit: gracefully exit the compatibiltiy console, waiting until all invocations have completed.
Run:
  run  --module/-m <module>: run a test module.
  run  --module/-m <module> --test/-t : run a specific test from the module. Test name can be .<class>, .<class>#<method> or <native_name>.
  run <plan> --retry <session_id>: run all failed tests from a previous session.
  run  --help/--help-all: get help for Compatibility Test Suite.
Options:
  --serial/-s : The device to run the test on.
  --abi/-a : The ABI to run the test against.
  --shards : Shards a run into the given number of independent chunks, to run on multiple devices in parallel.
  --logcat-on-failure: Capture logcat when a test fails.
  --bugreport-on-failure: Capture a bugreport when a test fails.
  --screenshot-on-failure: Capture a screenshot when a test fails.
List:
  l/list d/devices: list connected devices and their state
  l/list m/modules: list test modules
  l/list i/invocations: list invocations aka test runs currently in progress
  l/list c/commands: list commands aka test run commands currently in the queue waiting to be allocated devices
  l/list r/results: list results currently in the repository
Dump:
  d/dump l/logs: dump the tradefed logs for all running invocations
Add:
  a/add s/subplan: create a subplan from a previous session
Options:
  --session : The session used to create a subplan.
  --name/-n : The name of the new subplan.
  --result-type : Which results to include in the subplan. One of passed, failed, not_executed. Repeatable.

cts-tf >
  • 3执行命令

    run cts -m CtsCameraTestCases -t android.hardware.cts.CameraGLTest#testCameraToSurfaceTextureMetadata --skip-preconditions

    “-m” :意思就是我们要测试的模块
    “-t”:意思就是我们的测试的类
    “#后面的方法”:我们要测试类中的方法。
    如果要想执行某一个模块的测试项,直接用-m参数,其它参数就不需要了。如果想测试某一个类的话,需要加上-m 和-t的参数了。

后面其它版本的CTS等有机会用到,在来这里补充吧。

你可能感兴趣的:(Android CTS 测试)