zoukankan      html  css  js  c++  java
  • android测试 adb命令、Monkey命令

    (1)

    adb就是连接Android手机与PC端的桥梁,可以让用户在电脑上对手机进行全面的操作

    (2)

    a.查看当前所有的连接设备

    adb devices

     断开当前所有设置

    adb kill -server

    启动所有设备

    adb start -server

    b.进入手机内环境

    adb shell 

    c.获取设备状态

    adb get-state

    d.安装、卸载包

    adb install '.apk'

    adb uninstall '.apk'

    e.查看模拟器获取哪些包、获取当前运行的包名

    在window测试环境下

    在linux环境下

    adb shell dumpsys window |grep  'mCurrentFocus'

    或者使用aapt   

     或者使用

    f.adb连接设置

    adb connect 127.0.0.1:620001  连接夜神模拟器

    连接多个机器时,如果需要指定操作某台机器

    C:UsersAdministrator>adb devices
    List of devices attached
    fc2f9754        device
    d51ad9ff        device
     //此时我们就可以指定序列号,进入
    C:UsersAdministrator>adb -s d51ad9ff shell
    shell@cancro:/ $

    清除apk数据

    adb shell pm clear

    adb shell pm list package  |findstr meituan  展示 所有安装包

    h.从模拟器/设备中拷入或拷出文件

    adb pull /data/data/xx.txt D:install (/data/data/xx.txt 手机目录 D:install 电脑目录 )

    adb push foo.txt /sdcard/foo.txt

    i.重启手机
    adb reboot

    (3)

    Monkey

    使用monkey进行测试,包名com.xioa.sc  时间10000个,时间间隔100毫秒

    adb shell monkey -p com.xiao.sc  --throttle 100 10000

    1) 参数:  -p
    参数-p用于约束限制,用此参数指定一个或多个包(Package,即App)。指定包之后,Monkey将只允许系统启动指定的APP。如果不指定包,Monkey将允许系统启动设备中的所有APP。 

    * 指定一个包: adb shell monkey -p com.htc.Weather  100
    说明:com.htc.Weather为包名,100是事件计数(即让Monkey程序模拟100次随机用户事件)。

     

    2) 参数:  --throttle <</span>毫秒>
    用于指定用户操作(即事件)间的时延,单位是毫秒;

     

    * 示例:adb shell monkey -p com.htc.Weather --throttle 3000 100

     

    终极命令:

     

    参考地址:http://blog.sina.com.cn/s/blog_6fed0c780101ns8l.html

     

  • 相关阅读:
    实现 HTML页面 Table 标签分页打印
    windows定时休眠设置
    python画树
    anaconda历史版本
    枚举
    is 与 as 运算符举例
    Microsoft.ACE.OLEDB.12.0报错解决方法
    winform一个带自动完成功能的TextBox
    DWZ中整合第三方jQuery(kit日历控件)插件
    asp.net 使用NPOI,泛型反射,XML导入导出excel
  • 原文地址:https://www.cnblogs.com/zzzao/p/9190357.html
Copyright © 2011-2022 走看看