zoukankan      html  css  js  c++  java
  • AppCrawler 配置文件

    java -jar appcrawler.jar --demo

    demo.yml

    # 插件列表
    pluginList: [
      "com.testerhome.appcrawler.plugin.LogPlugin",
      "com.testerhome.appcrawler.plugin.TagLimitPlugin"
    ]
    # 是否截图
    saveScreen: true
    reportTitle: "Test Report"
    # 结果目录
    resultDir: "D:\appcrawler\results\20190907221950"
    # 在执行操作后等待多少毫秒刷新
    waitLoading: 500
    waitLaunch: 6000
    # 结果报告是否展示没有遍历被取消的控件
    showCancel: true
    # 最大运行时间
    maxTime: 10800
    # 默认的最大深度10, 结合baseUrl可很好的控制遍历的范围
    maxDepth: 10
    # appium的capability通用配置
    capability:
      # Appium是否需要自动安装和启动应用。默认值true  
      autoLaunch: "true"
    # 直接转换到 WebView 上下文。 默认值 false    
      autoWebview: ""
    # 不要在会话前重置应用状态。默认值false。
      noReset: "true"
      fullReset: "false"
      appium: "http://127.0.0.1:4723/wd/hub"
      deviceName: "GWY0217124003040"
      appPackage: "com.xueqiu.android"
      appActivity: ".view.WelcomeActivityAlias"
      # dontStopAppOnReset: true
      automationName: "uiautomator2"
      platformName: "Android"
      #以下为重置手机输入法为appium输入法
      unicodeKeyboard: true
      resetKeyboard: true
    # 测试用例
    testcase:
      name: "demo1"
      steps:
      - given: []
        when: null
        then: []
        xpath: "/*"
        action: "Thread.sleep(5000)"
        actions: []
        times: 0
    # 默认遍历列表
    selectedList:
    - given: []
      when: null
      then: []
      xpath: "//android.widget.TextView[@text='交易']"
      action: "click"
      actions: []
      times: 0
    - given: []
      when: null
      then: []
      xpath: "//android.widget.TextView[@text='我的']"
      action: "click"
      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: [ xpath: "//android.widget.TextView[@text='交易']", xpath: "//android.widget.TextView[@text='我的']" ] # 最后变量列表 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: "//android.widget.EditText[@text='请输入手机号或邮箱']" action: "18701137212" actions: [] times: 1 - given: [] when: null then: [] xpath: "//android.widget.EditText[@text='请输入登录密码']" action: "fengzi802300" actions: [] times: 1 - given: [] when: null then: [] xpath: "//android.widget.TextView[@text='登录']" action: "click" actions: [] times: 1 # 自动生成的xpath表达式里可以包含的匹配属性 xpathAttributes: - "name" - "label" - "value" - "resource-id" - "content-desc" - "instance" - "text" # 先按照深度depth排序,再按照list排序,最后按照selected排序。后排序是优先级别最高的 sortByAttribute: - "depth" - "list" - "selected" # 可选 default|android|id|xpath,默认状态会自动判断是否使用android定位或者ios定位 findBy: "default" # 用来确定url的元素定位xpath 他的text会被取出当作url因素 defineUrl: [] # 设置一个起始url和maxDepth, 用来在遍历时候指定初始状态和遍历深度 baseUrl: [] # app白名单 appWhiteList: [] # url黑名单,用户排除某些页面 urlBlackList: [] # url白名单 urlWhiteList: [] # 黑名单列表 匹配风格, 默认排除内容是2个数字以上的控件 blackList: - given: [] when: null then: [] xpath: ".*[0-9]{2}.*" action: null actions: [] times: 0 # 在重启session之前做的事情 beforeRestart: [] # 在执行action之前和之后默认执行的动作,比如等待 beforeElement: - given: [] when: null then: [] xpath: "/*" action: "Thread.sleep(500)" actions: [] times: 0 # 是否需要刷新或者滑动 afterElement: [] afterPage: [] # afterPage执行多少次后才不执行,比如连续滑动2次都没新元素即取消 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 # 只需要写given与then即可 assertGlobal: []

    参数说明:

    1.testcase

    given:所有的先决条件(通过xpath的方式进行匹配)

    when:先决条件成立后的行为

    then:断言集合

    简写:

    xpath:对应when里的xpath

    action:对应when的action

    2.动作支持 action

    back 后退

    backApp 回退到当前app

    monkey 随机事件

    xxx() 执行代码

    Thread.sleep(3000)

    driver.swipe(0.9,0.5,0.1,0.5)

    click

    longTap

    其他为输入操作

    3.动作次数 times

    0 无数次

  • 相关阅读:
    正则表达式语法介绍
    关系型数据库和非关系型数据库的简单对比
    lambda函数
    java基础系列--Exception异常处理
    springBoot基础系列--properties配置
    spring基础系列--JavaConfig配置
    java基础系列--Calendar类
    java基础系列--Date类
    一个特殊的List去重问题的解决方案
    Java学习笔记
  • 原文地址:https://www.cnblogs.com/changqing8023/p/12163632.html
Copyright © 2011-2022 走看看