Android APP 稳定性测试工具—Fastboot使用教程

背景:产品稳定后,没有特别多的bug的时候,一般用Monkey去测试应用的稳定性、健壮性(是否发生闪退,崩溃),但是使用过程中,Monkey的随机性也带来了困扰:⼿机经常会困在⼀个界⾯出不去,其他业务测试不到。网上搜索发现了:Fastboot 字节开发的稳定性工具,下面记录了它的使用方法。

1. 下载项目Fastbot-Android 

        将项目Fastbot-Android   git到本地,下载地址:
https://github.com/bytedance/Fastbot_Androidicon-default.png?t=M7J4https://github.com/bytedance/Fastbot_Android

2. 环境准备

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

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

  1. adb push libs  /data/local/tmp/

  2. adb push fastbot-thirdpart.jar /sdcard

  3. adb push framework.jar /sdcar

  4. 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 遍历时长(分钟) 
  • --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

 

6. 最后

未完待续

 

你可能感兴趣的:(测试工具)