zoukankan      html  css  js  c++  java
  • Android App 专项测试--压力测试篇(二)

    第二部分(实践):

    准备:

           下载android sdk    地址:https://developer.android.com/index.html

      配置环境变量 (for Ubuntu or mac)

           source /etc/profile  

      下载安装 python 2.7/3.6

    一个app压力测试实践:

      1. 准备一台笔记本 和 一部android手机。手机开发者选项,打开usb连接

      2. adb devices   查看设备

      3. 安装测试app。  adb install  package.apk

      4. 发送压力指令: adb shell monkey 1000

      5. 获取app 包名: adb logcat | grep START        或者  adb logcat | findstr START

         cmp= com.android.calculator2/.Calculator    ' / ' 之前的部分就是包名

      6. 指定包名 打压力测试

         adb shell monkey -p  com.android.calculator2  1000

      eg: 慕课app   packagename = cn.com.open.mooc

    Monkey 参数:

      1. throttle  参数

          adb shell monkey  --throttle  < milliseconds >

          指定时间之间的时间间隔

      2. seed 参数

          指令随机数的seed 值

       adb shell monkey  -s  < seed > <envent-count>

       adb shell monkey  -p  com.android.calculator2  -s 100  1000

      3. 触摸事件 

         设置触摸事件的百分比

         adb shell  monkey --pct-touch  < percent>

              adb shell monkey  -p  com.android.calculator2  -s 100  --pct-touch 50  1000

      4. 动作事件

         指定动作事件百分比

         adb shell  monkey --pct-motion < percent >      这个事件的百分比 和 其他事件的百分比 加起来 要等于100

        eg:  adb  shell monkey -v  -p com.android.calculator2  --pct-touch 50 --pct-motion 10  --pct-appswitch 40 1000

             其中 touch事件  50%  

                     motion事件 10%

                    appswitch事件 40%

                   一共随机执行1000次

      5. 其他事件

         轨迹球事件:adb  shell  monkey  --pct-trackball < percent >

         基本导航事件:adb shell monkey  --pct-nav  < percent >

         主要导航事件: adb shell monkey  --pct-majornav  <percent >

        系统导航事件 (Home键   BACK  拨号键 及音量键)adb shell monkey --pct-syskeys < percent >

        启动activity 事件(设定activity 的事件百分比): adb shell  monkey  -pct-appswitch < percent >

        设定不常用事件 : adb shell monkey  --pct-anyevent  < percent >

      6. 崩溃事件

          忽略崩溃 和 异常

          adb shell monkey --ignore-crashes < event-count >

      7. 超时事件

          ANR

          adb shell monkey  --ignore-timeouts < event-count >

       ANR 存放路径: adb shell  -- cd /data/anr/  --  ls -- traces.text----excepton 信息分析log

  • 相关阅读:
    [转载] IE8+兼容小结
    vue添加,删除内容
    vue跳转的两种方法
    checked 完整版全选,单选,反选
    网页特殊符号HTML代码大全
    利用css 实现 视觉差效果
    css 自定义滚动条样式
    js 模拟键盘
    css 动画 transition和animation
    浅谈浏览器垃圾回收机制
  • 原文地址:https://www.cnblogs.com/dongtian/p/7258782.html
Copyright © 2011-2022 走看看