Compile cts
../Build/envsetup. Sh
Make cts
Run CTs on device:
1、install ctsdelegatingaccessibilityservice.apk
2. Choose Settings> accessibility on the phone;
Choose Settings> Application> development;
Settings> sound & DISPLAY> screen timeout shocould be set to "Never timeout ";
3. Enter Android/out/host/linux-x86/CTS/Android-CTS/Repository/tools to run./startct script
4. If the following prompt appears, the CTS is started successfully and the device is connected.
Android CTS version 2.1 _ r2
Device (cbw.kadgr) connected
Cts_host>
5. Enter the command at the "cts_host>" prompt. The following are some common commands:
Help view all commands
Exit
Ls-P list all test packages
Ls -- plan list all test plans
Start -- Plan plan_name run a test scheme, such as: start -- Plan cts
Start -- Plan plan_name -- package package_name run a specific test package, such as: start -- Plan CTS -- package Android. Bluetooth
A) Method 1: the general method
$ CTS Note: if you use a mobile phone device for debugging, run the command with the root permission.
Cts_host> ls -- Plan: list all plans
Out/host/linux-x86/CTS/Android-CTS/Repository/plans has the specific content of plan
Cts_host> start -- Plan VM runs a plan
Test results in the out/host/linux-x86/CTS/Android-CTS/Repository/Results directory, use the browser to view the XML file under the time directory.
Note that after the CTS is changed, make CTS must be re-compiled. If it is only compiled in the CTS directory, it cannot take effect.
Cts_host> ls-P: view the currently available use case packages
Cts_host> start -- Plan Android-P Android. app only runs a test case package, saving time
Cts_host> start -- Plan Android-P Android. app-T Android. App. CTS. dialogtest # testonwindowfocuschanged
Only run a specific use case in a use case package
B) Method 2: The debugging method is convenient when a problem occurs.
$ ADB install out/target/product/xxxx/data/APP/sginaturetest.apk install a use case package
$ ADB shell PM list instrumentation PM is used to manage the package and check the use cases installed on the current machine.
$ ADB shell am instrument-W Android. Tests. sigtest/. instrumentationrunner am is used to manage the activity to run a certain use case.
$ ADB shell am instrument-E class android. App. CTS. alertdialogtest # testalertdialog-W com. Android. CTS. APP/Android. Test/instrumentationctstestrunner run a small case
If an error occurs somewhere in a long Plan (such as Android) and the error message is incomplete, you need to run a small case separately, specifying the class with-e can save a lot of time