自动遍历测试

第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: []

课间作业

完成雪球的行情-市场板块下的主要功能入口的遍历, 把配置文件回帖

2 Likes

先占楼~回头再编辑

占坑,再来5个字

占楼占楼占楼占楼

先占楼,至少输入8个字

占楼占楼占楼占楼

占楼,再来4字哈

占楼占楼占楼占楼

占楼占楼占楼占楼

来了来了~~~~

新人报道

课间作业 - 云配置

pluginList: []
saveScreen: true
reportTitle: "自动遍历测试实战-课间作业"
resultDir: "20200315132212"
waitLoading: 500
waitLaunch: 6000
showCancel: true
maxTime: 10800
maxDepth: 2
capability:
  noReset: "true"
  fullReset: "false"
  appium: "http://127.0.0.1:4723/wd/hub"
  appPackage: com.xueqiu.android
  appActivity: .view.WelcomeActivityAlias
testcase:
  name: "行情-市场板块遍历"
  steps:
  - xpath: "//android.widget.TextView[@text='行情']"	
action: click
then:
- //*[contains(@text,'市场')]
selectedList:
  - xpath: //*[contains(@text,"A股")]
  - xpath: //*[contains(@text,"港股")]
  - xpath: //*[contains(@text,"美股")]
  - xpath: //*[contains(@text,"全球")]
  - xpath: //*[contains(@text,"基金")]
  - xpath: //*[contains(@text,"期货")]
  - xpath: //*[contains(@text,"更多")]
firstList: []
lastList: []
backButton:
- xpath: "Navigate up"
triggerActions: []
xpathAttributes:
- "name"
- "label"
- "value"
- "resource-id"
- "content-desc"
- "instance"
- "text"
sortByAttribute:
- "depth"
- "list"
- "selected"
findBy: "default"
defineUrl: []
baseUrl: []
appWhiteList: []
urlBlackList: []
urlWhiteList: []
  # - ".*Main.*"
blackList:
  - xpath: //*[contains(@resource-id,"action_search")]
  - xpath: //*[contains(@resource_id,"action_message")]
  - xpath: //*[contains(@text,'自选股')]
  - xpath: 雪球
  - xpath: 交易
  - xpath: 我的
beforeRestart: []
beforeElement:
- given: []
  when: null
  then: []
  xpath: "/*"
  action: "Thread.sleep(1000)"
  actions: []
  times: 0
afterElement: []
afterPage: []
afterPageMax: 2
tagLimitMax: 2
tagLimit:
- given: []
  when: null
  then: []
  xpath: "确定"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "取消"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn_name"
  action: null
  actions: []
  times: 1000
assertGlobal: []

占楼,至少八个字

  • appcrawler版本:appcrawler-2.4.0-jar-with-dependencies.jar

  • 配置文件:

---
pluginList: []
saveScreen: true
reportTitle: ""
resultDir: "20200315113533"
waitLoading: 500
waitLaunch: 6000
showCancel: true
maxTime: 10800
maxDepth: 10
capability:
  appPackage: com.xueqiu.android
  appActivity: .view.WelcomeActivityAlias
  noReset: "true"
  fullReset: "false"
  appium: "http://127.0.0.1:4723/wd/hub"
testcase:
  name: "TesterHome AppCrawler"
  steps:
  - xpath: 行情
  - xpath: 市场
    action: click
selectedList:
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Button')]"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Text') and @clickable='true' and string-length(@text)<10]"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[@clickable='true']/*[contains(name(), 'Text') and string-length(@text)<10]"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Image') and @clickable='true']"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[@clickable='true']/*[contains(name(), 'Image')]"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Image') and @name!='']"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[contains(name(), 'Text') and @name!='' and string-length(@label)<10]"
  action: null
  actions: []
  times: 0
firstList: []
lastList:
- given: []
  when: null
  then: []
  xpath: "//*[@selected='true']/..//*"
  action: null
  actions: []
  times: 0
- given: []
  when: null
  then: []
  xpath: "//*[@selected='true']/../..//*"
  action: null
  actions: []
  times: 0
backButton:
- given: []
  when: null
  then: []
  xpath: "Navigate up"
  action: null
  actions: []
  times: 0
triggerActions:
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn"
  action: null
  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: null
  actions: []
  times: 0
beforeRestart: []
beforeElement:
- given: []
  when: null
  then: []
  xpath: "/*"
  action: "Thread.sleep(500)"
  actions: []
  times: 0
afterElement: []
afterPage: []
afterPageMax: 2
tagLimitMax: 2
tagLimit:
- given: []
  when: null
  then: []
  xpath: "确定"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "取消"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn_name"
  action: null
  actions: []
  times: 1000
assertGlobal: []

指定steps报错了,报错信息如下:
2020-03-15 13:02:32 INFO [Crawler.163.start] run steps
2020-03-15 13:02:32 INFO [Crawler.237.runSteps] run testcases
2020-03-15 13:02:32 INFO [AutomationSuite.13.beforeAll] beforeAll
AutomationSuite:
2020-03-15 13:02:32 INFO [AutomationSuite.21.$anonfun$new$1] testcase start
2020-03-15 13:02:32 INFO [AutomationSuite.28.$anonfun$new$2] Step(null,null,null,行情,null,null,0)
2020-03-15 13:02:32 INFO [AutomationSuite.31.$anonfun$new$2] 行情
2020-03-15 13:02:32 INFO [AutomationSuite.32.$anonfun$new$2]
2020-03-15 13:02:32 INFO [Crawler.996.doElementAction] current element = Steps.tag=TextView.depth=12.id=tab_name.text=行情
2020-03-15 13:02:32 INFO [Crawler.997.doElementAction] current index = 1
2020-03-15 13:02:32 INFO [Crawler.998.doElementAction] current action = null
2020-03-15 13:02:32 INFO [Crawler.999.doElementAction] current xpath = //[@resource-id=“com.xueqiu.android:id/decor_content_parent”]//[@resource-id=“android:id/content”]//[@resource-id=“android:id/tabhost”]//[@resource-id=“android:id/tabs”]//*[@text=“行情” and @resource-id=“com.xueqiu.android:id/tab_name”]
2020-03-15 13:02:32 INFO [Crawler.1000.doElementAction] current url = Steps
2020-03-15 13:02:32 INFO [Crawler.1001.doElementAction] current tag path = hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.TabHost/android.widget.LinearLayout/android.widget.TabWidget/android.widget.RelativeLayout/android.widget.TextView
2020-03-15 13:02:32 INFO [Crawler.1002.doElementAction] current file name = Steps.tag=TextView.depth=12.id=tab_name.text=行情
2020-03-15 13:02:32 INFO [AppCrawler$.59.saveReqHash] save reqHash to 1
2020-03-15 13:02:32 INFO [AppCrawler$.92.saveReqImg] save reqImg 20200315113533/1_Steps.tag=TextView.depth=12.id=tab_name.text=行情.click.png to 1
2020-03-15 13:02:32 INFO [AppCrawler$.76.saveReqDom] save reqDom to 1

  • run steps *** FAILED ***
    scala.MatchError: null
    at com.testerhome.appcrawler.Crawler.doElementAction(Crawler.scala:1012)
    at com.testerhome.appcrawler.AutomationSuite.$anonfun$new$2(AutomationSuite.scala:37)
    at com.testerhome.appcrawler.AutomationSuite.$anonfun$new$2$adapted(AutomationSuite.scala:27)
    at scala.collection.immutable.List.foreach(List.scala:389)
    at com.testerhome.appcrawler.AutomationSuite.$anonfun$new$1(AutomationSuite.scala:27)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
    at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
    at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
    at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
    at org.scalatest.Transformer.apply(Transformer.scala:22)

好像你步骤里不写action的话就会报错。。反正我这边是这样的,不写就会报你这个错,写了aciton: click 就没报错了

课间作业

---
pluginList: []
saveScreen: true
reportTitle: ""
resultDir: ""
waitLoading: 2000
waitLaunch: 6000
showCancel: true
maxTime: 10800
maxDepth: 10
capability:
  appPackage: com.xueqiu.android
  appActivity: .view.WelcomeActivityAlias
  platformName: Android
  automationName: uiautomator2
  noReset: true
  fullReset: false
  appium: "http://127.0.0.1:4723/wd/hub"
testcase:
  name: "XueQiu Market"
  steps:
  - xpath: "//*[@text='行情']"
    action: click
  - xpath: "//*[@text='市场']"
    action: click
selectedList:
- xpath: "//*[contains(@resource-id,'title_container')]/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.TextView"
  # 顶部 A股、港股、美股等

- xpath: "//*[contains(@resource-id,'indicator')]/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout[contains(@resource-id,'title_container')]/android.widget.TextView"
  # 沪深、板块、科创等

- xpath: "//*[@resource-id='com.xueqiu.android:id/indices']//*[@clickable='true']"
  action: click
  # 中间栏目 新股新债图标等(有滑动如何解决?)

- xpath: "//*[contains(@resource-id,'quote_center_entrance_container')]//*[@clickable='true']"
  action: click
  # 港股 中间图标部分

- xpath: "//*[@resource-id='com.xueqiu.android:id/indices_pager']/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout"
  action: click
  # 中间指数部分(设置了但未点击?)

firstList:
- xpath: "//*[@resource-id='com.xueqiu.android:id/indices_pager']/androidx.recyclerview.widget.RecyclerView/android.widget.LinearLayout"
  action: click
  # 中间指数部分(设置了但未点击?)
lastList:
- xpath: "//*[@resource-id='com.xueqiu.android:id/indices']//*[@clickable='true']"
  action: click
  # 中间栏目 新股新债图标等(有滑动如何解决?)

- xpath: "//*[contains(@resource-id,'quote_center_entrance_container')]//*[@clickable='true']"
  action: click
  # 港股 中间图标部分
- xpath: "//*[contains(@resource-id,'indicator')]/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout[contains(@resource-id,'title_container')]/android.widget.TextView"
  # 沪深、板块、科创等

- xpath: "//*[contains(@resource-id,'title_container')]/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.TextView"
  # 顶部 A股、港股、美股等

backButton:
- given: []
  when: null
  then: []
  xpath: "Navigate up"
  action: ""
  actions: []
  times: 0
triggerActions: []
xpathAttributes:
- "name"
- "label"
- "value"
- "resource-id"
- "content-desc"
#- "instance"
- "text"
sortByAttribute:
- "depth"
- "list"
- "selected"
findBy: "default"
defineUrl: []
baseUrl: []
appWhiteList: []
urlBlackList: []
urlWhiteList: []
blackList: []
beforeRestart: []
beforeElement:
- given: []
  when: null
  then: []
  xpath: "/*"
  action: "Thread.sleep(1000)"
  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: []


:grin:谢谢天马,每个步骤都加上action就OK了!

课间作业

注:testcase中不写action或值为null会报错

---
# 插件使用,默认提供ProxyPlugin、LogPlugin、tagLimitPlugin
# 可自定义插件扩展功能更好的遍历策略(放在项目的plugins下)
pluginList: []
# 保存操作页面的截图
saveScreen: true
# 生成报告名称
reportTitle: ""
# 运行结果目录
resultDir: "20200315150559"
# 等待加载时间(即每个操作超时时间)
waitLoading: 500
waitLaunch: 6000
showCancel: true
# 最大运行时间,即本次遍历运行时间?
maxTime: 120
# 最深遍历程度
maxDepth: 3
# appium启动项配置
capability:
  appPackage: "com.xueqiu.android"
  appActivity: ".view.WelcomeActivityAlias"
  noReset: "true"
  fullReset: "false"
  appium: "http://127.0.0.1:4723/wd/hub"
# 指定要操作的元素,遍历前工作
testcase:
  name: "test xueqiu"
  # 指定的多个操作元素
  steps:
  - xpath: //*[contains(@resource-id, "tab_name") and @text="行情"]
    action: click
  # 匹配某个条件的元素,默认click操作(testcase中不写action或值为null会报错),可以换成其他的操作如back、swipe
  - xpath: //*[contains(@resource-id, "title_text") and @text="市场"]
    action: click
# 需要被遍历的元素范围
selectedList:
# given、when、then?
# A股、港股、美股、全球、基金、期货、更多
- xpath: //*[contains(@resource-id, "viewpager")]//*[contains(@resource-id, "title_text")]
  times: 4
# A股下沪深、板块等,港股下港股、沪深港通等
- xpath: //*[contains(@resource-id, "pager")]/android.widget.TextView
  times: 3
# A股下新股新债、雪球热股等
- xpath: //*[contains(@resource-id, "entrance_view_pager")]/android.widget.TextView
  times: 3
# 下半部分带箭头标题栏:如A股-沪深下市场总览、大盘异动,A股-板块下行业板块等
- xpath: //android.widget.RelativeLayout[contains(@resource-id, "root")]
  times: 0
# 下半部分带箭头占一行标题栏:如A股-沪深下沪深榜单等
- xpath: //*[contains(@resource-id, "common_title")]
  times: 2
# 在selectedList中被优先遍历的元素
firstList: []
# 在selectedList中被最后遍历的元素
lastList:
- xpath: //*[contains(@resource-id, "viewpager")]//*[contains(@resource-id, "title_text")]
# 被测app中所有种类的返回按钮,方便某遍历中随机进行返回操作
backButton:
- xpath: //*[contains(@resource-id, "action_bar_back")]
- given: []
  when: null
  then: []
  xpath: //*[contains(@resource-id, "action_back")]
  action: click
  actions: []
  times: 0
# 遇到什么样的元素(xpath)执行什么操作(action)
triggerActions:
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn"
  action: null
  actions: []
  # 表示本规则被应用几次,默认0表示永久生效
  times: 0
# 本次遍历支持的xpath定位方式,testcase、selectedList等定制的操作中xpath可用范围
xpathAttributes:
- "name"
- "label"
- "value"
- "resource-id"
- "content-desc"
- "instance"
- "text"
# 遍历策略的优先级(深度优先还是广度优先等)
sortByAttribute:
- "depth"
- "list"
- "selected"
findBy: "default"
defineUrl: []
baseUrl: []
appWhiteList: []
# appcrawler将每个页面定义为不同url,如 .Main
# 遍历的页面黑名单
urlBlackList: []
# 遍历的页面白名单,默认全部遍历
urlWhiteList: []
# 匹配条件的元素黑名单,遇到就跳过不操作
blackList:
- given: []
  when: null
  then: []
  xpath: ".*[0-9]{2}.*"
  action: null
  actions: []
  times: 0
beforeRestart: []
# 遇到匹配条件的元素之后执行的操作,如每个元素操作之后等待5s(防止操作太快页面还没加载完)
beforeElement:
- given: []
  when: null
  then: []
  xpath: "/*"
  action: "Thread.sleep(500)"
  actions: []
  times: 0
# 遇到匹配条件的元素之后执行的操作
afterElement: []
# 切换页面(url)之前的操作
afterPage: []
afterPageMax: 2
# 同一个tag操作的最大次数
tagLimitMax: 2
# 特定类型元素遍历的最大操作,等价类无须重复操作
tagLimit:
- given: []
  when: null
  then: []
  xpath: "确定"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "取消"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn_name"
  action: null
  actions: []
  times: 1000
assertGlobal: []

课间作业

---
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='行情']
    action: click
  - xpath: //*[@text='市场']
    action: click
selectedList:
- xpath: //*[@resource-id='com.xueqiu.android:id/indicator_layout']//*[contains(@class, 'TextView')]
         #中间下面涨幅榜部分

- xpath: //*[@resource-id='com.xueqiu.android:id/indicator']//*[contains(@class, 'TextView')]
         #顶部A股票部分
firstList: 
    - xpath: //*[@resource-id='com.xueqiu.android:id/indicator_layout']//*[contains(@class, 'TextView')]
         #优先执行,涨幅榜的遍历
         #执行顺序策略比较重要,如果先执行A股到最后由于不在A股的页签下,就无法点击到涨幅榜部分
         #关于深度设置:被测目标的深度如果小于设置的深度,发现还是会继续点击,此时是按照通用规则执行么
lastList:
    - xpath: //*[@resource-id='com.xueqiu.android:id/indicator']//*[contains(@class, 'TextView')]
         #最后执行A股票title的遍历
backButton:
- given: []
  when: null
  then: []
  xpath: "Navigate up"
  action: null
  actions: []
  times: 0
triggerActions:
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn"
  action: null
  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: null
  actions: []
  times: 0
beforeRestart: []
beforeElement:
- given: []
  when: null
  then: []
  xpath: "/*"
  action: "Thread.sleep(500)"
  actions: []
  times: 0
afterElement: []
afterPage: []
afterPageMax: 2
tagLimitMax: 20
  #最深层级12,偷懒设置成了20,发现行情与市场也算在深度范围内
tagLimit:
- given: []
  when: null
  then: []
  xpath: "确定"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "取消"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn_name"
  action: null
  actions: []
  times: 1000
assertGlobal: []

课间作业:

---
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"
  appium: "http://127.0.0.1:4723/wd/hub"
testcase:
  name: "TesterHome AppCrawler"
  steps:
  - xpath: //*[contains(@resource-id, 'tabs')]//*[@text='行情']
    action: click
  - xpath: 市场
    action: click

selectedList:
#A股、港股、美股、全球、基金等
- xpath: "//*[@resource-id='com.xueqiu.android:id/indicator']//*[contains(@class, 'TextView')]"
#上证指数、深证成指、创业板指等
- xpath: "//*[@resource-id='com.xueqiu.android:id/indices_pager']//*[@clickable='true']"
#新股新债、雪球热股、选股策略等
- xpath: "//*[@resource-id='com.xueqiu.android:id/entrance_view_pager']//*[contains(@class, 'TextView')]"
#港股:选股策略、新股日历、融资融券等
- xpath: "//*[@resource-id='com.xueqiu.android:id/quote_center_entrance_container']//*[contains(@class, 'TextView')]"
#全球:各个指数的view
- xpath: "//*[@resource-id='com.xueqiu.android:id/recycler_view']//*[@clickable='true']"
#沪深、板块、科创等
- xpath: "//*[@resource-id='com.xueqiu.android:id/pager']//*[@resource-id='com.xueqiu.android:id/title_container']//*[contains(@class, 'TextView')]"

firstList:
- xpath: "//*[@resource-id='com.xueqiu.android:id/quote_center_entrance_container']//*[contains(@class, 'TextView')]"
- xpath: "//*[@resource-id='com.xueqiu.android:id/entrance_view_pager']//*[contains(@class, 'TextView')]"
- xpath: "//*[@resource-id='com.xueqiu.android:id/pager']//*[@resource-id='com.xueqiu.android:id/title_container']//*[contains(@class, 'TextView')]"
- xpath: "//*[@resource-id='com.xueqiu.android:id/indices_pager']//*[@clickable='true']"
- xpath: "//*[@resource-id='com.xueqiu.android:id/recycler_view']//*[@clickable='true']"

lastList:
- xpath: "//*[@resource-id='com.xueqiu.android:id/indicator']//*[contains(@class, 'TextView')]"



backButton:
- given: []
  when: null
  then: []
  xpath: "Navigate up"
  action: null
  actions: []
  times: 0
triggerActions:
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn"
  action: null
  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: null
  actions: []
  times: 0
beforeRestart: []
beforeElement:
- given: []
  when: null
  then: []
  xpath: "/*"
  action: "Thread.sleep(500)"
  actions: []
  times: 0
afterElement: []
afterPage: []
afterPageMax: 10
tagLimitMax: 100
tagLimit:
- given: []
  when: null
  then: []
  xpath: "确定"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "取消"
  action: null
  actions: []
  times: 1000
- given: []
  when: null
  then: []
  xpath: "share_comment_guide_btn_name"
  action: null
  actions: []
  times: 1000
assertGlobal: []

课间作业

---
pluginList: []
saveScreen: true
reportTitle: ""
resultDir: "20200318185718"
waitLoading: 500
waitLaunch: 6000
showCancel: true
maxTime: 10800
maxDepth: 10
capability:
  appPackage: com.xueqiu.android
  appActivity: .view.WelcomeActivityAlias
  noReset: "true"
  fullReset: "false"
  appium: "http://127.0.0.1:4723/wd/hub"
testcase:
  name: "TesterHome AppCrawler"
  steps:
  - xpath: 行情
    action: click
  - xpath: 市场
    action: click
selectedList:
# 页面的最上面头部(A股、港股、美股等)
- xpath: "//*[contains(@resource-id, 'title_container')]/*/*/android.widget.TextView"
# (A股、港股、美股等)标签页下面的分标签(沪深、板块、场内、场外等)
- xpath: "//*[contains(@resource-id, 'indicator')]/*/*/*[contains(@resource-id, 'title_container')]/android.widget.TextView"
# A股页面下的大标签(雪球热股、龙虎榜等)
- xpath: "//*[contains(@resource-id, 'entrance_view_pager')]//android.widget.TextView"
# 美股页面下的大标签(选股策略等)
- xpath: "//*[contains(@resource-id, 'head_container')]/*/*[@class='android.widget.TextView' and not(contains(@resource-id, 'common_title'))]"
# 全球页面下的市场(恒生指数等)
- xpath: "//*[contains(@resource-id, 'recycler_view')]/*/android.widget.LinearLayout"
firstList: 
- xpath: "//*[contains(@resource-id, 'entrance_view_pager')]//android.widget.TextView"
- xpath: "//*[contains(@resource-id, 'head_container')]/*/*[@class='android.widget.TextView' and not(contains(@resource-id, 'common_title'))]"
- xpath: "//*[contains(@resource-id, 'indicator')]/*/*/*[contains(@resource-id, 'title_container')]/android.widget.TextView"
- xpath: "//*[contains(@resource-id, 'recycler_view')]/*/android.widget.LinearLayout"
lastList:
- xpath: "//*[contains(@resource-id, 'title_container')]/*/*/android.widget.TextView"
xpathAttributes:
- "name"
- "label"
- "value"
- "resource-id"
- "content-desc"
- "instance"
- "text"
sortByAttribute:
- "depth"
- "list"
- "selected"
findBy: "default"
defineUrl: []
baseUrl: []
appWhiteList: []
urlBlackList: []
urlWhiteList: []
blackList: []
beforeRestart: []
backButton:
- xpath: "//*[@content-desc='转到上一层级']"
- xpath: "//*[contains(@resource-id, 'action_back')]"
beforeElement: []
afterElement: []
afterPage: []
afterPageMax: 2
tagLimitMax: 10
tagLimit: []
assertGlobal: []
关闭