> The Compatibility Test Suite (CTS) is a free, commercial-grade test suite, available for download. The CTS r
epresents the "mechanism" of compatibility.
The CTS runs on a desktop machine and executes test cases directly on attached devices or an emulator. T
he CTS is a set of unit tests designed to be integrated into the daily workflow (such as via a continuous build
system) of the engineers building a device. Its intent is to reveal incompatibilities early on, and ensure that
the software remains compatible throughout the development process.
The CTS is an automated testing harness that includes two major software components:
a. The CTS tradefed test harness runs on your desktop machine and manages test execution.
b. Individual test cases are executed on the Device Under Test (DUT). The test cases are written in Java
as JUnit tests and packaged as Android .apk files to run on the actual device target.
The Compatibility Test Suite Verifier (CTS Verifier) is a supplement to the CTS available for download. CTS Ve
rifier provides tests for APIs and functions that cannot be tested on a stationary device without manual inp
ut (e.g. audio quality, accelerometer, etc).
The CTS Verifier is a tool for manual testing and includes the following software components:
a. The CTS verifier app that is executed on the DUT and collects the results.
b. The executable(s) or script(s) that are executed on the desktop machine to provide data or additional
control for some test cases in the CTS Verifier app.
准备环境
1.ADB and AAPT
如果之前你已经编译了Android的image, 可以在out/host/linux-x86/bin/中找到这两个service的文件,要做
的就是将他们加到环境变量里面:
export PATH=$PATH:<YOUR_ANDROID_ROOT>/out/host/linux-x86/bin/
1
2.JDK 要求
The master branch of Android in AOSP:
Ubuntu - OpenJDK 8, Mac OS - jdk 8u45 or newer
Android 5.x (Lollipop) - Android 6.0 (Marshmallow):
Ubuntu - OpenJDK 7, Mac OS - jdk-7u71-macosx-x64.dmg
3.CTS package 要求
Android CTS version
N cts-7.0
M cts-6.0
Run CTS的常用命令
cts-7.0 相比 cts-6.0已经做了很大的修改,已知的改动有:
a. 去掉了–package 选项 (替换为-m module选项)
b. 去掉了android-cts\repository\testcases*.xml
(这个改动很confuse, 因为不能再通过xml文件去过滤掉不想跑的cases, 另外也不能知道这个package包含
多少个test cases,取而代之的是只能跑一遍,通过测试结果才能知道具体的cases)
N M 描述
-m module -t test_name -c class -m method run a specific test class and/or method
So, 如果想单独run android.keystore这个package包含的所有的cases, 在6.0和7.0的cts里要用不同的co
mmand:
cts-6.0
./cts-tradefed run cts --package android.keystore --disable-reboot --skip-preconditions
1
cts-7.0
常用命令 描述
–>l r list results currently in the repository
–>l c list the commands currently in the queue
cts6.0–>run cts –continue-session [session-id] run all not executed tests from a previous CTS session
cts7.0–>run cts –retry [session-id] run all failed tests from a previous session