Android CTS 测试

来源:互联网 发布:数据库系统概论公开课 编辑:程序博客网 时间:2024/05/21 18:46

  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 Compatibility Test Suite 7.0_r9 (3943095)cts-tf > helpCompatibility Test SuiteCTS is the test harness for running the Android Compatibility Suite, built on top of Trade Federation.Available commands and optionsHost:  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 <plan> --module/-m <module>: run a test module.  run <plan> --module/-m <module> --test/-t <test_name>: run a specific test from the module. Test name can be <package>.<class>, <package>.<class>#<method> or <native_name>.  run <plan> --retry <session_id>: run all failed tests from a previous session.  run <plan> --help/--help-all: get help for Compatibility Test Suite.Options:  --serial/-s <device_id>: The device to run the test on.  --abi/-a <abi>: The ABI to run the test against.  --shards <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 repositoryDump:  d/dump l/logs: dump the tradefed logs for all running invocationsAdd:  a/add s/subplan: create a subplan from a previous sessionOptions:  --session <session_id>: The session used to create a subplan.  --name/-n <subplan_name>: The name of the new subplan.  --result-type <status>: 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等有机会用到,在来这里补充吧。

原创粉丝点击