第11期——monkey maxim遍历测试⼯具
root@x86:/ # cat /system/bin/monkey
# Script to start "monkey" on the device, which has a very rudimentary
# shell.
#
base=/system
export CLASSPATH=$base/framework/monkey.jar
trap "" HUP
exec app_process $base/bin com.android.commands.monkey.Monkey $*
root@x86:/ # monkey
usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
[-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
[--ignore-crashes] [--ignore-timeouts]
[--ignore-security-exceptions]
[--monitor-native-crashes] [--ignore-native-crashes]
[--kill-process-after-error] [--hprof]
[--pct-touch PERCENT] [--pct-motion PERCENT]
[--pct-trackball PERCENT] [--pct-syskeys PERCENT]
[--pct-nav PERCENT] [--pct-majornav PERCENT]
[--pct-appswitch PERCENT] [--pct-flip PERCENT]
[--pct-anyevent PERCENT] [--pct-pinchzoom PERCENT]
[--pct-permission PERCENT]
[--pkg-blacklist-file PACKAGE_BLACKLIST_FILE]
[--pkg-whitelist-file PACKAGE_WHITELIST_FILE]
[--wait-dbg] [--dbg-no-events]
[--setup scriptfile] [-f scriptfile [-f scriptfile] ...]
[--port port]
[-s SEED] [-v [-v] ...]
[--throttle MILLISEC] [--randomize-throttle]
[--profile-wait MILLISEC]
[--device-sleep-time MILLISEC]
[--randomize-script]
[--script-log]
[--bugreport]
[--periodic-bugreport]
[--permission-target-system]
COUNT
maxim
git clone https://github.com/zhangzhao4444/Maxim.git
cd Maxim
adb push framework.jar /sdcard
adb push monkey.jar /sdcard
adb shell \
CLASSPATH=/sdcard/monkey.jar:/sdcard/framework.jar \
exec app_process /system/bin tv.panda.test.monkey.Monkey \
-p com.xueqiu.android \
--uiautomatormix \
--running-minutes 60 -v -v
遍历模式:uiautomatormix、uiautomatordfs、uiautomatortroy
Android Cralwer
第11期——AppCrawler跨平台⾃动遍历测试
最新版本2.4.0
构建:进入2.3.1分支,使用maven即可打包
seveniruby:appcrawler seveniruby$ java -jar appcrawler-2.4.0-jar-with-dependencies.jar
----------------
AppCrawler 2.4.0 [霍格沃兹测试学院特别纪念版]
Appium 1.8.1 Java8 tested
app爬虫, 用于自动遍历测试. 支持Android和iOS, 支持真机和模拟器
项目地址: https://github.com/seveniruby/AppCrawler
移动测试技术交流: https://testerhome.com
联络作者: seveniruby@testerhome.com (思寒)
致谢: 晓光 泉龙 杨榕 恒温 mikezhou yaming116 沐木
--------------------------------
Usage: appcrawler [options]
-a, --app <value> Android或者iOS的文件地址, 可以是网络地址, 赋值给appium的app选项
-e, --encoding <value> set encoding, such as UTF-8 GBK
-c, --conf <value> 配置文件地址
-p, --platform <value> 平台类型android或者ios, 默认会根据app后缀名自动判断
-t, --maxTime <value> 最大运行时间. 单位为秒. 超过此值会退出. 默认最长运行3个小时
-u, --appium <value> appium的url地址
-o, --output <value> 遍历结果的保存目录. 里面会存放遍历生成的截图, 思维导图和日志
--capability k1=v1,k2=v2...
appium capability选项, 这个参数会覆盖-c指定的配置模板参数, 用于在模板配置之上的参数微调
-r, --report <value> 输出html和xml报告
--template <value> 输出代码模板
--master <value> master的diff.yml文件地址
--candidate <value> candidate环境的diff.yml文件
--diff 执行diff对比
-vv, --verbose 是否展示更多debug信息
--demo 生成demo配置文件学习使用方法
--help
示例
appcrawler -a xueqiu.apk
appcrawler -a xueqiu.apk --capability noReset=true
appcrawler -c conf/xueqiu.json -p android -o result/
appcrawler -c xueqiu.json --capability udid=[你的udid] -a Snowball.app
appcrawler -c xueqiu.json -a Snowball.app -u 4730
appcrawler -c xueqiu.json -a Snowball.app -u http://127.0.0.1:4730/wd/hub
#生成demo例子
appcrawler --demo
#启动已经安装过的app
appcrawler --capability "appPackage=com.xueqiu.android,appActivity=.view.WelcomeActivityAlias"
#从已经结束的结果中重新生成报告
appcrawler --report result/
#新老版本对比
appcrawler --candidate result/ --master pre/ --report ./
xpath测试
获取page source
adb shell "uiautomator dump && cat /sdcard/window_dump.xml" | sed 1d
把内容保存到pycharm里,比如source.xml, 使用pycharm中的xpath测试插件就可以测试你的xpath语法
第11期——⾃动遍历测试实战
---
pluginList: []
saveScreen: true
reportTitle: ""
resultDir: ""
waitLoading: 500
waitLaunch: 6000
showCancel: true
maxTime: 10800
maxDepth: 10
capability:
appPackage: com.xueqiu.android
appActivity: .view.WelcomeActivityAlias
noReset: "true"
fullReset: "false"
dontStopAppOnReset: true
appium: "http://127.0.0.1:4723/wd/hub"
testcase:
name: "TesterHome AppCrawler"
steps:
- xpath: //*[contains(@resource-id, 'tabs')]//*[@text='行情']
- xpath: 市场
action: click
selectedList:
- xpath: "//*[@resource-id='com.xueqiu.android:id/indicator']//*[contains(@class, 'TextView')]"
- xpath: "//*[@resource-id='com.xueqiu.android:id/indices']//*[@clickable='true']"
firstList: []
lastList:
- xpath: "//*[@resource-id='com.xueqiu.android:id/indicator']//*[contains(@class, 'TextView')]"
backButton:
- given: []
when: null
then: []
xpath: "Navigate up"
action: ""
actions: []
times: 0
triggerActions:
- given: []
when: null
then: []
xpath: "share_comment_guide_btn"
action: ""
actions: []
times: 0
xpathAttributes:
- "name"
- "label"
- "value"
- "resource-id"
- "content-desc"
#- "instance"
- "text"
sortByAttribute:
- "depth"
- "list"
- "selected"
findBy: "default"
defineUrl: []
baseUrl: []
appWhiteList: []
urlBlackList: []
urlWhiteList: []
blackList:
- given: []
when: null
then: []
xpath: ".*[0-9]{2}.*"
action: ""
actions: []
times: 0
beforeRestart: []
beforeElement:
- given: []
when: null
then: []
xpath: "/*"
action: "Thread.sleep(500)"
actions: []
times: 0
afterElement: []
afterPage: []
afterPageMax: 2
tagLimitMax: 20
tagLimit:
- given: []
when: null
then: []
xpath: "确定"
action: ""
actions: []
times: 1000
- given: []
when: null
then: []
xpath: "取消"
action: ""
actions: []
times: 1000
- given: []
when: null
then: []
xpath: "share_comment_guide_btn_name"
action: ""
actions: []
times: 1000
assertGlobal: []
课间作业
完成雪球的行情-市场板块下的主要功能入口的遍历, 把配置文件回帖