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

adb shell am pm的更多相关文章

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

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/zi_zhe/article/details/72229201 在命令行可用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 am/pm 常用命令详解与使用

    一.adb shell am 使用此命令可以从cmd控制台启动 activity, services:发送 broadcast等等 1.am start <packageName/.classN ...

  4. 获取手机安装的所有包名adb shell pm list packages

    获取所有已安装包的包名:adb shell pm list packages 查找:adb shell pm list packages|findstr suning

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

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

  6. adb shell pm list packages的用法

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

  7. adb shell中的am pm命令

    adb shell中的am pm命令,一些自己的见解和大多数官网的翻译. am命令 am全称activity manager,你能使用am去模拟各种系统的行为,例如去启动一个activity,强制停止 ...

  8. adb、adb shell am、adb shell pm命令的详细使用说明

    本文博客地址:http://blog.csdn.net/qq1084283172/article/details/64183248 1.在命令行终端执行下面的命令: adb >adb.txt 2 ...

  9. 使用adb shell卸载程序

    个人感觉在命令行中卸载程序要比在手机界面卸载程序要方便许多,配合命令行下的报名查看包名的命令就更加方便了. 1.查看应用准确包名 adb shell pm list package -f |grep ...

随机推荐

  1. a标签加绝对定位在图片上面,a的链接和块状属性block失效,而且是所有IE版本都失效的

    谷歌和火狐浏览器下测试是正常的,IE下鼠标移过logo是没有超链接的提示的 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitio ...

  2. 制作 leanote docker 镜像

    leanote 使用 mongodb 存储数据,如果把 mongodb 单独做成一个镜像,初始化数据时比较麻烦,所以最后还是决定把 mongodb 和 leanote 放到同一个镜像里边. docke ...

  3. Scala学习笔记--正则表达式基础知识、如何在scala内使用

    正则表达式语法:https://msdn.microsoft.com/zh-cn/library/ae5bf541(VS.80).aspx 基础知识:正则表达式30分钟入门教程 http://www. ...

  4. Google Chrome源码剖析【序】

    [序(本人什么都没做,完全转载)] 开源是口好东西,它让这个充斥着大量工业垃圾代码和教材玩具代码的行业,多了一些艺术气息和美的潜质.它使得每个人,无论你来自米国纽约还是中国铁岭,都有机会站在巨人的肩膀 ...

  5. windows下编译firefox

    可以自己定制下.估计很简单..... 官方文档扫一遍: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_I ...

  6. poj 2481 Cows(数状数组 或 线段树)

    题意:对于两个区间,[si,ei] 和 [sj,ej],若 si <= sj and ei >= ej and ei - si > ej - sj 则说明区间 [si,ei] 比 [ ...

  7. 什么是野指针?(What is a wild pointer?)

    未被初始化的变量称为野指针(wild pointer).顾名思义,我们不知道这个指针指向内存中的什么地址,使用不当程序会产生各种各样的问题. 理解下面的例子: int main() { int *p; ...

  8. 初探JS正则表达式

    1.概述     正则表达式是一个描述字符模式的对象.Javascript的正则表达式语法的是Perl5的正则表达式的子集.JS正则表达式有两种使用方式,文本模式和RegExp对象模式,实例如下: v ...

  9. Android应用开发学习之AlertDialog对话框

    作者:刘昊昱 博客:http://blog.csdn.net/liuhaoyutz 本文中我们通过一个例子来看AlertDialog对话框的实现,其运行效果如下: 主布局文件main.xml内容如下: ...

  10. python爬爬(网友提供学习)

    import urllib2,urllib,os,re def ZZ(url): pathw=os.getcwd() #图片和标题目录 imagetitleregion=r'<div class ...