利器 | AppCrawler 自动遍历测试实践(三):动手实操与常见问题

上两篇文章介绍了 自动遍历的测试需求、工具选择和 AppCrawler 的环境安装、启动及配置文件字段基本含义,这里将以实际案例更加细致的说明配置文件的用法和一些特殊场景的处理。

实操演示

常规使用

下面我们继续之前的例子,在雪球搜索框输入搜索内容后的页面开始:

testcase:设置测试用例,输入 alibaba 后,点选"阿里巴巴"在这里插入图片描述
yaml 写法如下:在这里插入图片描述
selectedList:遍历范围设定
接上一步点选"阿里巴巴"后到达如下界面:在这里插入图片描述
我们先看demo配置文件中的原始写法,如下: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

原始文件中将所有可点击的控件类型都包括了进去,再加上了部分 text 长度的限制 现在我们按照自己平常的简便写法重新编写,先设置所有 clickable 等于 true 的控件进行点击:

在 Android 中,一个控件如果绑定了用户响应行为的事件,那么 clickable 的属性值就是 true

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值