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

390 Views Asked by At

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. Is there a way to execute the remaining steps even if some steps fail in pytest bdd?

1

There are 1 best solutions below

0
On

May be you just need to define the code implementation of "I should have <left_c> cucumbers" with a verification instead of assert. The verification can be caught in the report.html to view the failure reason. At the same time, the code will continue to execute the next "Then" statement as well without any issues. Since the code implementation is not added in the question, can't help further.