【问题标题】:How to continue execution of steps in Pytest BDD with scenario outline如何使用场景大纲继续执行 Pytest BDD 中的步骤
【发布时间】:2021-07-27 12:17:51
【问题描述】:

我正在尝试实现功能场景大纲,类似于以下内容:

Feature: Scenario outlines
    Scenario Outline: Outlined given, when, then
        Given there are <start> cucumbers
        Given there are <start> apples
        When I eat <eat> cucumbers
        When I eat <eat> apples
        Then I should have <left_c> cucumbers
        Then I should have <left_a> apples

        Examples:
        | start | eat | left_c | left_a |
        |  12   |  5  |  4     | 7      |

这里I should have &lt;left_c&gt; cucumbers会失败,不考虑第二步就会停止执行。 即使pytest bdd中的某些步骤失败,有没有办法执行剩余的步骤?

【问题讨论】:

    标签: python pytest bdd gherkin pytest-bdd


    【解决方案1】:

    也许你只需要用验证而不是断言来定义“我应该有 黄瓜”的代码实现。可以在report.html中捕获验证,查看失败原因。同时,代码也将继续执行下一个“Then”语句,没有任何问题。 由于问题中没有添加代码实现,无法进一步帮助。

    【讨论】:

      猜你喜欢
      • 2021-07-27
      • 1970-01-01
      • 2018-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-13
      • 2020-09-16
      • 2015-01-29
      相关资源
      最近更新 更多