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 InstrumentationTestCaseor 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 thecoverageFile 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

摘自:http://blog.sina.com.cn/s/blog_51335a0001017ux5.html

adb shell am 的用法的更多相关文章

  1. (转)adb shell am 的用法

    原文地址:http://blog.csdn.net/fulinwsuafcie/article/details/8092459   adb shell am 的功能 adb shell am 使用此命 ...

  2. adb shell am pm 用法

    Using activity manager (am) Within an adb shell, you can issue commands with the activity manager (a ...

  3. adb shell dumpsys的用法

    一. 打印出设备中所有service的信息 zh@zh:~$adb shell dumpsys -l (字母l)zh@zh:~$adb shell service list 二.查询到运行的syste ...

  4. adb shell pm list packages的用法

    abd shell pm list packages     ####查看当前连接设备或者虚拟机的所有包 adb shell pm list packages -d    #####只输出禁用的包. ...

  5. Android系统在超级终端下必会的命令大全(adb shell命令大全)

    . 显示系统中全部Android平台: android list targets . 显示系统中全部AVD(模拟器): android list avd . 创建AVD(模拟器): android c ...

  6. Android自动化测试手段之Monkey(adb shell monkey)

    一. 什么是Monkey Monkey是Android中的一个命令行工具,可以运行在模拟器里或实际设备中.它向系统发送伪随机的用户事件流(如按键输入.触摸屏输入.手势输入等),实现对正在开发的应用程序 ...

  7. adb shell am broadcast 手动发送广播及adb shell am/pm其他命令

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/zi_zhe/article/details/72229201 在命令行可用adb shell am ...

  8. adb shell 命令之----pm

    常用的用法: 查看已经安装的包: pm list packages 查看已经安装的包以及apk路径(-3:只看第三方应用: -s:只看系统应用) -f: see their associated fi ...

  9. 【android】android 常用adb 和 adb shell 命令

    db是SDK自带的工具,可实现桥接功能:adb shell 可以与手机系统建立交互,是基于andoid Linux系统下的操作 ADB常用命令: 1. 查看设备         adb  device ...

随机推荐

  1. tomcat7或8如何修改浏览器标题上的ICON小图标

    替换tomcat根目录/webapps/ROOT下的favicon.ico文件,之后重启了服务器,可是还是显示那只猫的图标. 如果不能显示,请清除浏览器的缓存

  2. C#代码篇:代码产生一个csv文件调用有两个核心的坑

    忙活了半天终于可以开工了,a物品到底要不要放进去取决于两个因素,第一是a有4kg重,只有背包大于等于4kg的时候才能装进去(也就是说当i=1,k<4时f[i,k]=0):第二是当背包的重量大于等 ...

  3. surface pro系统按键+重装系统

    一. 如果无法进入系统: surface pro1代,可以插入U盘启动盘,然后按音量键上键,然后按电源键,然后释放电源键,然后等屏幕上"Surface"出来后,释放音量键. 2代以 ...

  4. 转:JMeter 参数化之利用JDBC Connection Configuration从数据库读取数据并关联变量

    1.   下载mysql jar包 下载mysql jar包 http://dev.mysql.com/downloads/connector/j/ 网盘下载地址:mysql-connector-ja ...

  5. Linux权限解释

    从左至右,第一位数字代表文件所有者的权限,第二位数字代表同组用户的权限,第三位数字代表其他用户的权限. 而具体的权限是由数字来表示的,读取的权限等于4,用r表示:写入的权限等于2,用w表示:执行的权限 ...

  6. Spring 后置处理器 PropertyPlaceholderConfigurer 类(引用外部文件)

    一.PropertyPlaceholderConfigurer类的作用 PropertyPlaceholderConfigurer 是 BeanFactory 后置处理器的实现,也是 BeanFact ...

  7. C#6.0新特性之字符串嵌入 String Interpolation

    6.0增加了 字符串嵌入值 的新语法糖. 以前我们做拼接的时候,一般这样写 var s = string.Format("this is a {0} !!!" , class1.p ...

  8. js--3目运算符

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...

  9. thinkphp u 方法

    public function test(){ $this->display();echo U('Index/test',array('id'=>1),false,'localhost') ...

  10. java default使用

    我们都知道在Java语言的接口中只能定义方法名,而不能包含方法的具体实现代码.接口中定义的方法必须在接口的非抽象子类中实现.下面就是关于接口的一个例子: public interface Simple ...