ANDROID_ADB Shell AM/PM Use

Source: Internet
Author: User

Transferred from: http://blog.sina.com.cn/s/blog_51335a0001017ux5.html

ADB shell AM instrument [options] <COMPONENT>

Role: Initiates monitoring of the instrument instance.

parameters [Options]:

-e <key> <value>//-e options need to be placed before the-w option

Function: Provides a test option that exists as a key-value pair. Several key-value pairs are available in Android, as described in the following table.
Example:-E class Com.android.phone.fincomingcalltests#testrejectcall

-R

Function: Output test results in original form. This option is typically used with the-e perf true when performing a performance test.

Parameter <component>:

-W <test_package_name>/<runner_class>//<test_package_name> and <runner_class> Find in the androidmanifest.xml of the test project

Role: Keep adb shell open until test complete
Example:-W Com.android.phone.tests/com.android.phone.runners.functionaltestrunner

<key> <value> Reference Table

Key Value Description
package <Java_package_name> The fully-qualified Java package name is the packages in the test application. Any test case class, this uses the package name is executed. Notice that's not aAndroid package name; A test package had a single Android package name and may have several Java packages within it.
class <class_name> The fully-qualified Java class name for one of the test case classes. Only the test case class is executed.
<class_name>#Method Name A fully-qualified test Case class name, and one of the its methods. Only this method is executed. Note the hash mark (#) between the class name and the method name.
func true Runs all test classes that extend InstrumentationTestCase .
unit true Runs All test classes This does not extend either InstrumentationTestCase or PerformanceTestCase .
size [small | medium |large] Runs a test method annotated by size. The annotations is @SmallTest , @MediumTest and @LargeTest .
perf true Runs all test classes that implement PerformanceTestCase . When you use this option, also specify -r the "flag am instrument for," so "the output is kept in raw format and not Re-forma tted as test results.
debug true Runs tests in debug mode.
log true Loads and logs all specified tests, but does not run them. The test information appears in STDOUT . Use the verify combinations of other filters and test specifications.
emma true Runs a EMMA code Coverage analysis and writes the output to on the /data//coverage.ec device. To override the file location and use the key, which is described in the coverageFile following entry.

Note: This option requires a emma-instrumented build of the the test application, which you can generate with the coverage target.

coverageFile <filename>

Overrides The default location of the ' EMMA coverage file ' on the device. Specify this value as a path and filename in UNIX format. The default filename is described in the entry for the emma key

ADB shell am start [options] <INTENT>

Role: Initiate an activity

Example: ADB shell am start-a Com.lt.test.action.SECOND

Example: ADB shell am start-n com.lt.test/. MyActivity

Description: [options] and <INTENT> see http://developer.android.com/tools/help/adb.html#am

ADB shell am startservice [options] <INTENT>

Role: Start a service

Example: ADB shell am startservice-a Com.lt.test.action.ONESERVICE
Example: ADB shell am startservice-n com.lt.test/. MyService

ADB shell am force-stop <PACKAGE>
Role: Forcing an application to close

Example: ADB shell am force-stop com.lt.test

ADB shell am Broadcast [options] <INTENT>

Role: Send a broadcast
Example: ADB shell am Broadcast-a "action_finish" (sending a broadcast to close an activity)
Example: ADB shell am broadcast-a Android.intent.action.MASTER_CLEAR (Factory reset method, will erase all memory contents)

Example: ADB shell am broadcast-n com.lt.test/. Mybroadcast

ADB shell PM List packages [Options] <INTENT>

Role: List all package containing <INTENT>

Example: ADB shell pm List Packages com.lt

Description: [options] and <INTENT> see HTTP://DEVELOPER.ANDROID.COM/TOOLS/HELP/ADB.HTML#PM

Reference Links:

Http://developer.android.com/tools/help/adb.html

ANDROID_ADB Shell AM/PM Use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.