测试工具-AppCrawler
背景
大家知道Monkey是Android平台上进行压力稳定性测试的工具,通过Monkey可以模拟用户触摸屏幕、滑动、按键等伪随机用户事件来对设备上的程序进行压力测试。而原生的Android Monkey存在一些缺陷:
事件太过于随机,测试有效性大打折扣
由于Monkey主要发送一些随机事件来进行测试,测试过程中的事件操作不受控制,大部分操作是无效的(比如点击的是空白区域、在不能滑动的页面进行滑动等等)。
对App页面内的控件覆盖率不佳
也是因为随机性这一特点,不能保证App页面的所有控件都能得到有效覆盖测试。
有概率跳出测试
点击到通知栏或者状态栏,就会跳转到其他的页面,从而中断当前App的测试。
工具Google App crawler
Google官方推出的App遍历工具,相比Monkey基于伪随机的事件,App Crawler是基于控件的遍历,可以更好的去遍历App的功能。
官方网址:
https://developer.android.google.cn/training/testing/crawler
目标受众
App Crawler 的目标用户是那些希望以最少配置确保应用基本功能的开发人员。除了纯黑盒测试之外,还可以配置爬虫程序来提供特定的输入,比如登录凭证或深度链接
使用
1.运行命令java -jar appcrawler-2.4.0-jar-with-dependencies.jar --demo,会在当前目录下生成一个demo.yml文件,这个文件就是我们进行定制化的配置文件模板:
2.打开配置文件demo.yaml如下
---
pluginList: []
saveScreen: true
reportTitle: ""
resultDir: "00000000"
waitLoading: 500
waitLaunch: 6000
showCancel: true
maxTime: 10800
maxDepth: 10
capability:
noReset: "true"
fullReset: "false"
appium: "http://127.0.0.1:4723/wd/hub"
testcase:
name: "AppCrawler"
steps:
- given: []
when: null
then: []
xpath: "/*"
action: "Thread.sleep(5000)"
actions: []
times: 0
selectedList:
- given: []
when: null
then: []
xpath: "xpath"
action: null
actions: []
times: 0
- given: []
when: null
then: []
xpath: "xpath"
action: null
actions: []
times: 0