Eclipse single debugging Cts, eclipse debugging cts
In the Cts test, a single failure is a common task, but it is troublesome to find the cause. Although the command line of the cts provides a single test method, only the result is output, at most, the log of device and host is retained. It is not common to debug with eclipse. I thought of this problem today and studied how to debug the Cts in eclipse:
First of all, Cts testing depends on apk, so its debugging is similar to app debugging.
1. Use Cts command line to test the failure items separately and find the corresponding apk from the information provided by log.
2. Install this apk and try to run it. If there is activity, then am start is fine.
3. If no activity is available, only instrumentation is required. am instrument is required. This command is not commonly used.
am instrument: start an Instrumentation. Typically this target <COMPONENT> is the form <TEST_PACKAGE>/<RUNNER_CLASS>. Options are: -r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT). Use with [-e perf true] to generate raw output for performance measurements. -e <NAME> <VALUE>: set argument <NAME> to <VALUE>. For test runners a common form is [-e <testrunner_flag> <value>[,<value>...]]. -p <FILE>: write profiling data to <FILE> -w: wait for instrumentation to finish before returning. Required for test runners. --user <USER_ID> | current: Specify user instrumentation runs in; current user if not specified. --no-window-animation: turn off window animations while running. --abi <ABI>: Launch the instrumented process with the selected ABI. This assumes that the process supports the selected ABI.
The description is not very clear. It can be seen that the name of an instrument named am instrument-r-w XXX can be used to run the instrument.
How to run a single item? -E
For example:
Am instrument-r-e class android. provider. cts. MediaStore_FilesTest # testAccess-w com. android. cts. provider/android. support. test. runner. AndroidJUnitRunner
Android. provider. cts. MediaStore_FilesTest # testAccess is not very familiar with this string. By the way, the package name class name and method name are printed during a single test of cts.
Com. android. cts. provider/android. support. test. runner. AndroidJUnitRunner is the name of instrumentation. How do you know? AndroidManifest.
You can also find it through the pm list instrumentation.
OK. It is easy to run this apk. eclipse can attach for debugging.
Finding a time to attach is also the key. here we can use am set-debug-app to create a time. This is a very meaningful command. I will try again later.