App稳定性测试-Fastbot使用笔记

背景:最近一直在寻求一款可以做app稳定性的测试工具,大部分文章推荐使用的monkey,利用随机事件来对app做大量点击事件的测试。其实除了monkey,还有很多开源的工具。如:基于appium的appcrawler     如maxim,fastbot基于monkey的二次开发的稳定性测试工具。下面记录下使用字节跳动开源工具fastbot的使用方法。

1.下载项目Fastbot-Android 

      将项目Fastbot-Android   git到本地,下载地址:GitHub - bytedance/Fastbot_Android: Fastbot(2.0) is a model-based testing tool for modeling GUI transitions to discover app stability problemshttps://github.com/bytedance/Fastbot_Android

2.环境准备

         1) pc端需要有安卓adb的环境,即手机连接电脑后,在cmd上输入adb  devices能够查看到设备

        2)将项目中的jar包和lib目录下的文件导入到测试手机,建议导入到/sdcard   和/data/local/tmp/

adb push libs  /data/local/tmp/
adb push fastbot-thirdpart.jar /sdcard
adb push framework.jar /sdcar
adb push monkeyq.jar /sdcard

3.启动Fastbot

        环境准备好后,根据需求执行以下命令,参数可以自定义。

adb -s 设备号 shell CLASSPATH=/sdcard/monkeyq.jar:/sdcard/framework.jar:/sdcard/fastbot-thirdpart.jar exec app_process /system/bin com.android.commands.monkey.Monkey -p 包名 --agent reuseq --running-minutes 遍历时长 --throttle 事件频率 -v -v

备注:参数的含义                                                                                                                      

         -s 设备号 多个设备需要指定设备号,单独设备无需此-s参数
         -p 包名 遍历app的包名,-p+包名
         --agent reuseq 遍历模式,无需更改
         --running-minutes 遍历时长(分钟) # 遍历时间:--running-minutes 时间
         --throttle 事件频率 遍历事件频率,建议为500-800

可选参数:

        --bugreport 崩溃时保存bug report log
        --output-directory /sdcard/xxx log/crash 另存目录

4.报告分析

        程序运行完后,会打印出崩溃carsh,anr 以及monkey事件的数量,如果有崩溃,可以cd 到手机/sdcard/crash-dump.log文件中查看,捕获的Anr 同时也会写入 /sdcard/oom-traces.log 文件

5.高速截图

        新增一个文件名为:max.config 在文件中写入

  • max.takeScreenshot = true
  • max.takeScreenshotForEveryStep = true
  • max.saveGUITreeToXmlEveryStep =true                            

       然后将max.config文件push到手机端/sdcard  ,--throttle 参数要 >200 才会截图

adb push max.config /sdcard

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>