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

  • 相关阅读:
    通过 cygwin64 自己编译对应的 Tera Term cyglaunch.exe
    氚云人事文档介绍
    氚云派单文档介绍
    H3 BPM接口说明文档
    H3 BPM V10.1 产品更新日志
    H3 BPM V10.0 产品更新日志
    统一协同工作平台用户管理、单点登录以及任务集成接口说明
    H3 BPM前后台交互方法介绍
    介绍遍历子表的方法
    氚云tERP产品介绍-功能
  • 原文地址:https://www.cnblogs.com/dongtian/p/7258782.html
Copyright © 2011-2022 走看看