CTS test, the single failure is a common thing, want to find the cause is more troublesome, because the CTS command line, although providing a single test method, but only output results, at most, retain the device and host log, It is less common to debug with eclipse. Today, I think of this problem, the method of debugging CTS items under Eclipse is studied:
First of all, the CTS test is mainly to rely on the APK, so its debugging is similar to the debugging of the app.
1. Test the failure individually with the CTS command line and find the corresponding apk from the information in log.
2. Install this apk, try to get it to run, if there is activity, that am start is good.
3. If there is no activity only instrumentation, it is necessary to use AM instrument, this command is not very common
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 the process supports the selected ABI.
The description is not very clear, probably can be seen through AM instrument-r-W XXX a instrumentation name to run this instrumentation.
How do I run a single item? To use the-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 This string is not very familiar with, right, is the CTS single test when printed out the east, package name Class name plus method name.
Com.android.cts.provider/android.support.test.runner.androidjunitrunner This string is instrumentation's name, how do I know? There's androidmanifest in there.
Through the PM list instrumentation can also be found out.
OK, as long as you can make this apk run up, Eclipse can be attach to debug.
Find a time to attach is also the key, here you can use AM set-debug-app to create the time. This is a very connotation of the order, to find a time to analyze again.
Eclipse Debugging CTS Items