title: Android测试 - Monkey压力测试
date: 2017-03-15 13:18:12
tags: [压力测试, android]
category: android


基本语法

adb shell monkey [options] 

开始一个随机测试

adb shell monkey -p [package name] -v [event-count]adb shell monkey -p com.nerc.communityedupro -v 2000
  • -p 后面跟 包名,表示需要测试的应用
  • -v 表示显示测试事件
  • 2000 表示测试事件的数量 (越大,测试过程越久,测试程度越高)

如何出现问题后如何复现

-s : Seed value for pseudo-random number generator. If you re-run the Monkey with the same seed value, it will generate the same sequence of events.

使用 -s 命令给本次测试命名,相同的 seed 名称对应相同的测试过程。

注意 seed 名称必须是数字

adb shell monkey -s 1 -p com.nerc.communityedupro 100

在没有设置 seed 的情况下,在测试过程用应用 creash 后,monkey 会返回一个 seed。(所以在测试的时候通常不需要测试这个值)

复现问题的时候需要将应用的初始状态设置到一样,最好是直接后台关闭。

减慢测试事件的速度

--throttle : Inserts a fixed delay between events. You can use this option to slow down the Monkey. If not specified, there is no delay and the events are generated as rapidly as possible.
adb shell monkey --throttle 300 -p com.nerc.communityedupro 100

使用脚本测试固定事件

monkeyrunner UI 测试脚本

官方文档

参考:

  • https://developer.android.com/studio/test/monkey.html
  • https://developer.android.com/training/testing/start/index.html
  • http://www.vogella.com/tutorials/AndroidTesting/article.html
  • http://blog.csdn.net/jieqiang3/article/details/53928638

更多相关文章

  1. 细数Android(安卓)Studio中使用junit4测试框架中的坑
  2. android 下写文件性能测试
  3. android 单元测试
  4. [android]在上下文菜单的选中事件中获取列表选中的元素
  5. android 多点触控
  6. Android(安卓)-- Android(安卓)JUint 与 Sqlite
  7. Android解决父控件拦截子控件手势滑动事件的问题
  8. Android下模拟按键输入
  9. android touch事件解析

随机推荐

  1. 深度学习在医学影像中的研究进展及发展趋
  2. 【精简教程版】100行代码入手天池CV赛事
  3. 通俗讲解集成学习算法!
  4. 基于关系图谱的人岗关系研究
  5. 上分神器:训练调参与模型集成
  6. 联邦学习算法综述
  7. 生成技术在人工智能平台中的应用探索
  8. 深度学习「CV」学习实践指南!
  9. 深入浅出卷积神经网络及实现!
  10. 教育大数据隐私保护机制与技术研究