简体   繁体   English

如何使用场景大纲继续执行 Pytest BDD 中的步骤

[英]How to continue execution of steps in Pytest BDD with scenario outline

I'm trying to implement a Feature scenario outline, something similar to below:我正在尝试实现功能场景大纲,类似于以下内容:

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      |

Here I should have <left_c> cucumbers will fail and the execution will stop without considering the second step.在这里I should have <left_c> cucumbers会失败并且执行将停止而不考虑第二步。 Is there a way to execute the remaining steps even if some steps fail in pytest bdd?即使 pytest bdd 中的某些步骤失败,是否有办法执行剩余步骤?

May be you just need to define the code implementation of "I should have <left_c> cucumbers" with a verification instead of assert.可能您只需要使用验证而不是断言来定义“我应该有 <left_c> 黄瓜”的代码实现。 The verification can be caught in the report.html to view the failure reason.验证可以在报告中抓到html查看故障原因。 At the same time, the code will continue to execute the next "Then" statement as well without any issues.同时,代码也将继续执行下一个“Then”语句,没有任何问题。 Since the code implementation is not added in the question, can't help further.由于问题中没有添加代码实现,因此无法进一步提供帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Pytest Bdd:即使一个失败,如何继续执行 BDD 中的步骤 - Pytest Bdd : How to continue execution of steps in BDD even if one failed 如何阻止 pytest_bdd 在 Gherkin 场景大纲的每次迭代后执行拆卸步骤? - How to stop pytest_bdd from performing the teardown steps after each iteration of a Gherkin Scenario Outline? pytest bdd通过@scenario模块 - pytest bdd pass @scenario module pytest-bdd:如何从@given获取当前方案? - pytest-bdd: how to get current scenario from @given? pytest-bdd:导入常用步骤 - Pytest-bdd: Importing common steps 有没有办法在 pytest-bdd“When”步骤中使用 pytest.raises? - Is there a way to use pytest.raises in pytest-bdd "When" steps? 如何在示例中使用 pytest bdd 为场景语句传递相同参数的不同值 - How to pass different values for same parameter in Example using pytest bdd for scenario statement 如何在 pytest BDD 使用固定装置的特定场景测试结束时运行特定的 function - How to run a specific function at the end of a specific scenario test in pytest BDD using fixtures 我如何在相同的场景中使用相同的步骤,但在 pytest-bdd 中使用不同的参数? - How might I use the same step in the same scenario, but with different parameters in pytest-bdd? 如何在pytest_bdd中的另一个功能文件实现中重用一个功能文件实现的步骤定义? - How to reuse steps definition of one feature file implementation in another one in pytest_bdd?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM