adb shell am instrument [options] <COMPONENT>
作用:启动对instrument实例的监视。
参数[options]:
-e <key> <value> // -e选项需要放在-w选项之前
作用:提供了以键值对形式存在的测试选项。Android中提供了多种键值对,具体参见下表。
举例:-e class com.android.phone.FIncomingCallTests#testRejectCall
-r
作用:以原始形式输出测试结果。该选项通常是在性能测试时与-e perf true一起使用。
参数 <COMPONENT>:
-w <test_package_name>/<runner_class> //<test_package_name>和<runner_class>在测试工程的AndroidManifest.xml中查找
作用:保持adb shell打开直至测试完成
举例:-w com.android.phone.tests/com.android.phone.runners.FunctionalTestRunner
<key> <value>参考表
Key Value Description
package <Java_package_name> The fully-qualified Java package name for one of the packages in the test application. Any test case class that uses this package name is executed. Notice that this is not an Android package name; a test package has a single Android package name but may have several Java packages within it.
class <class_name> The fully-qualified Java class name for one of the test case classes. Only this test case class is executed.
<class_name>#method name A fully-qualified test case class name, and one of 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 that do not extend either InstrumentationTestCase or PerformanceTestCase.
size [small | medium | large] Runs a test method annotated by size. The annotations are @SmallTest, @MediumTest, and @LargeTest.
perf true Runs all test classes that implement PerformanceTestCase. When you use this option, also specify the -r flag for am instrument, so that the output is kept in raw format and not re-formatted 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 this to verify combinations of other filters and test specifications.
emma true Runs an EMMA code coverage analysis and writes the output to /data//coverage.ec on the device. To override the file location, use the coverageFile key that is described in the following entry.
Note: This option requires an EMMA-instrumented build of 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>
作用:启动一个activity
举例:adb shell am start -a com.lt.test.action.SECOND
举例:adb shell am start -n com.lt.test/.MyActivity
说明:[options]与<INTENT>参见 http://developer.android.com/tools/help/adb.html#am
adb shell am startservice [options] <INTENT>
作用:启动一个service
举例:adb shell am startservice -a com.lt.test.action.ONESERVICE
举例:adb shell am startservice -n com.lt.test/.MyService
adb shell am force-stop <PACKAGE>
作用:强制关闭一个应用程序
举例:adb shell am force-stop com.lt.test
adb shell am broadcast [options] <INTENT>
作用:发送一个广播
举例:adb shell am broadcast -a "action_finish" (发送一个广播去关闭一个activity)
举例:adb shell am broadcast -a android.intent.action.MASTER_CLEAR(恢复出厂设置的方法,会清除内存所有内容)
举例:adb shell am broadcast -n com.lt.test/.MyBroadcast
adb shell pm list packages [options] <INTENT>
作用:列举出所有包含<INTENT>的package
举例:adb shell pm list packages com.lt
说明:[options]与<INTENT>参见 http://developer.android.com/tools/help/adb.html#pm
参考链接:
http://developer.android.com/tools/help/adb.html
分享到:
相关推荐
Android adb_shell
abd shell to compromise android
android adb shell 命令大全 1. 显示系统中全部Android平台: android list targets 2. 显示系统中全部AVD(模拟器): android list avd 3. 创建AVD(模拟器): android create avd --name 名称 --...
在开发展讯平台android手机时发现通用的adb安装方法是无法成功连接adb的,因此找到了文档中介绍的这个有效的方法。 文档及文档中绑定的附件文件包括: 1、安装方法文字描述; 2、展讯通用adb驱动(适用于大部分...
Mac 上使用 Shell 脚本 + adb shell 实现简单的 Android 模拟点击自动化测试
android_USB_adb_driver.rar ADB调试、使用必备
Android_adb的一些命令.doc Android_adb的一些命令.doc
adb for debugging windows android
android执行adb shell命令源码,亲测可用!
android_adb命令大全.doc,很全的,觉得有用的就下载下来
linux arm版本的adb安装包,解压缩后,放到linux下任一目录下 chmod 777 install_adb.sh ./install_adb.sh 就可以自动安装,adb 1.0.39版本
Android ADB shell命令的使用及参考例子
adb Makefile处理。可以单独编译ADB。
android adb的基本用法,入门者可以参考以下,重在实践
Android Driver for HTC Moible Phone.
2.minimal_adb_fastboot_v1.4.3(内含adb命令和卸载列表)
Android_ADB命令介绍,非常详细的介绍了ADB命令的。大部分是常用命令。
adb源码官网:https://android.googlesource.com/platform/system/core/可在以上链接获取adb源码集成到项目中。若下载失败可以下载上面的附件。
Android 用Shell命令设置静态ip https://blog.csdn.net/qq_31939617/article/details/81530531
安卓迷你adb工具,可用于chrome浏览器调试连不上手机修复. 具体使用参考博文 https://blog.csdn.net/Wang__dream/article/details/103791181