zoukankan      html  css  js  c++  java
  • app稳定性测试,Monkey介绍

    App稳定性测试

    一、Monkey介绍
    1、什么是稳定性测试?
    2、monkey
    探索性测试--测试思维


    二、Monkey命令
    1、PC与设备(真机、模拟器)连接
    设备端:打开USB调试

    cmd--》adb devices
    List of devices attached
    daemon not running; starting now at tcp:5037
    * daemon started successfully
    手动连接:cmd-->adb connect 设备号
    adb connect 127.0.0.1:62001
    connected to 127.0.0.1:62001
    查看是否连接:cmd-->adb devices
    List of devices attached
    127.0.0.1:62001 device

    2、命令


    1)事件数
    adb shell monkey 100

    2)频率
    adb shell monkey --throttle 1000 50
    好处:
    1:尽可能模拟用户的操作
    2:通过频率来设置不同的压力
    --throttle 100
    --throttle 1000
    3:通过频率和事件数量来控制运行时间
    --monkey命令模拟用户操作,持续执行1分钟
    大部分用户的执行频率是0.5s,1s
    1分钟=60s=60000ms
    1000ms*次数=60000ms ==》次数=60

    adb shell monkey --throttle 1000 60

    时间长--稳定性测试 app 24小时 ???

    3)指定执行的应用
    查看应用的包名
    adb shell pm list packages 所有应有的包名
    adb shell pm list packages -s 系统应用的包名
    adb shell pm list packages -3 第三方应用的包名

    adb shell monkey -p com.wuba --throttle 1000 50
    adb shell monkey -p com.wuba -p com.handsgo.jiakao.android 200

    4)日志 -v
    -v 记录最简单的日志
    -v -v
    -v -v -v 记录最详细的日志

    adb shell monkey -p com.wuba -v 100
    adb shell monkey -p com.wuba -v -v 100
    adb shell monkey -p com.wuba -v -v -v 100
    adb shell monkey -p com.wuba -v -v -v 100 >D:appwuba.log

    5)seed值
    发送事件的唯一标识
    如果执行命令时指定的seed值一致,则发送的事件是一样的,否则发送的事件是不一样的。

    案例:在执行monkey指令过程中,出现的应用停止运行的错误,那么我们该如何去复现这个错误呢?

    执行同样的monkey命令,并且指定同样的seed值,从而再去复现这个问题

    6)调试选项
    --ignore-crashes 忽略在应用程序出现crash时导致的monkey停止
    --ignore-timeouts 忽略在应用程序出现ANR问题时导致monkey停止
    --ignore-security-exceptions 忽略应用程序发生许可错误时导致monkey停止
    --kill-process-after-error 当应用程序发生错误时,应用程序停止运行并保持在当前状态

    adb shell monkey -p com.wuba --throttle 500 --ignore-crashes --ignore-timeouts --ignore-security-exceptions --kill-process-after-error -v-v-v 50


    三、项目案例实战
    1:拿到包名 adb shell pm list packages -3
    com.tal.kaoyan
    2:模拟用户操作
    --throttle 1000
    3:执行市场10-12小时-->次数
    10h=600min=60*600s=60*600*1000ms

    次数*1000 =60*600*1000 次数=36000
    4:执行过程中不能被中断
    调试选项

    5:记录日志
    -v -v -v

    adb shell monkey -p com.tal.kaoyan --throttle 1000 --ignore-crashes --ignore-timeouts --ignore-security-exceptions --kill-process-after-error -v-v-v 36000 >d:kaoyan.log

    6:批处理文件

  • 相关阅读:
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    Security and Cryptography in Python
    《EffectiveJava中文第二版》 高清PDF下载
    《MoreEffectiveC++中文版》 pdf 下载
    《啊哈c语言》 高清 PDF 下载
  • 原文地址:https://www.cnblogs.com/gskk/p/13298595.html
Copyright © 2011-2022 走看看