微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我们如何跨步骤使用数据表?

如何解决我们如何跨步骤使用数据表?

我们在主页上有一些分类图块,通过这些图块过滤产品,例如:-图块 1 属于衣服,点击后页面显示衣服,图块 2 属于鞋子,一旦点击如下页面显示鞋子等。

目标是点击tile1,验证文本和产品,点击tile2验证文本和产品,等等。

我想用一个数据表来测试这个场景

这是特征文件内容:-

Scenario Outline: Filtering the products on the home page
    Given the user is on the homepage
    When the user selects the <category> tile for filtering the products
      | category              |
      | cat 1                 |
      | cat 2                 |
      | cat 3                 |
      | cat 4                 |
   Then only the relevant products should be displayed to the user

问题是,我想在同一步骤中单击并验证,但使用上述设置,我将无法做到这一点。关于如何做到这一点的任何建议/意见?

详细信息:- 当我单击磁贴时,新页面将加载左侧的磁贴文本和相关产品,这两个操作一个一个发生,因此我想在同一步骤中执行此操作,但看起来不对在给定的时间和然后的上下文中

解决方法

如果您想对每个测试日期进行验证,category 表应该在 Examples 中。

Scenario Outline: Filtering the products on the home page
    Given the user is on the homepage
    When the user selects the <category> tile for filtering the products
    Then only the relevant products should be displayed to the user

Examples:
      | category              |
      | cat 1                 |
      | cat 2                 |
      | cat 3                 |
      | cat 4                 |

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。