我们如何跨步骤使用datatable?

2024-04-24 05:51:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我们在主页上有一些分类贴片,产品通过这些分类贴片进行过滤,例如:-贴片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

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

详细信息:-当我单击互动程序时,新页面将加载左侧的互动程序文本和相关产品,这两个操作会一个接一个地发生,因此我希望在同一步骤中执行此操作,但不会在给定的时间和时间上下文中向右看


1条回答
网友
1楼 · 发布于 2024-04-24 05:51:53

如果要验证每个测试日期,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                 |

相关问题 更多 >