CTS说明文档 http://source.android.com/compatibility/cts-intro.html
CTS软件下载 http://source.android.com/compatibility/downloads.html
0. 用usb链接主机和测试机
1. 在测试机安装两个APK:CtsDelegatingAccessibilityService.apk,CtsDeviceAdmin.apk
adb install ./android-cts/repository/testcases/CtsDelegatingAccessibilityService.apk
adb install ./android-cts/repository/testcases/CtsDeviceAdmin.apk
2. cd到tools目录下
yasin@ubuntut:~/mywork/CTS/android-cts/tools$ lscts-tradefed cts-tradefed.jar ddmlib-prebuilt.jar hosttestlib.jar junit.jar README tradefed-prebuilt.jar
3. 执行cts-tradefed
yasin@ubuntu:~/mywork/CTS/android-cts/tools$ ./cts-tradefed
看到如下内容说明已经建立连接
02-05 15:54:14 I/DeviceManager: Detected new device 19761202cts-tf >
4. 执行测试用例
cts-tf > run cts -c android.permission.cts.FileSystemPermissionTest
结果显示:
cts-tf > run cts -c android.permission.cts.FileSystemPermissionTest
02-05 15:59:23 I/TestInvocation: Starting invocation for 'cts' on build '4.0.3_r3' on device 19761202
02-05 15:59:23 I/19761202: Created result dir 2013.02.05_15.59.23
cts-tf > 02-05 15:59:46 I/19761202: Collecting device info
02-05 15:59:47 I/19761202: -----------------------------------------
02-05 15:59:47 I/19761202: Test package android.permission started
02-05 15:59:47 I/19761202: -----------------------------------------
02-05 15:59:49 I/19761202: android.permission.cts.FileSystemPermissionTest#testAllBlockDevicesAreSecure PASS
……
……
02-05 16:00:07 I/19761202: Saved log host_log_1977870639530690915.zip
02-05 16:00:07 I/19761202: android.permission package complete: Passed 18, Failed 2, Not Executed 0
02-05 16:00:07 I/19761202: Created xml report file at file:///home/yasin/mywork/CTS/android-cts/tools/./../../android-cts/repository/results/2013.02.05_15.59.23/testResult.xml
02-05 16:00:07 I/19761202: XML test result file generated at 2013.02.05_15.59.23. Passed 18, Failed 2, Not Executed 0
02-05 16:00:07 I/19761202: Time: 44s
测试结束,用浏览器打开上面的xml文件可看到更详细的测试结果。