-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
context.execute_steps: Support @runner.continue_after_failed_step (hint: does not work when multiple steps are called) #953
Comments
Feature file: Feature: Opt-In (HasOffers)
@runner.continue_after_failed_step
Scenario Outline: Opt-in end2end test starting with a HasOffers link
Given that I follow a HasOffers link to the "<page_name>" landing page
Then I verify pixel tracking events test
steps in py file @step('I verify pixel tracking events test')
def verify_pixel_events(context):
context.execute_steps('''
then I want to test1
and I want to test2
''')
@step('I want to test1')
def test1(context):
assert False
@step('I want to test2')
def test1(context):
print('Hello') |
So my issue is after the step 'I want to test1' fails it does not execute step 'I want to test2'. How can i make it work? |
In general, it is a bad idea to continue executing steps after the first one has failed.
|
The reason I am using here the multiple steps I am calling are independent of each other. So its fine if one fails and other passes I just want it to go thru all the steps. Will I need to use try catch and ask it to execute even if exception occurs? |
What is the failure: An assert failed (AssertionError exception) or another exception ? NOTES: |
Yes it is an AssertionError exception.
|
Then:
|
I don’t want to disable the assert statement as I want to capture them. So I can catch and ignore the exception, that way the step will fail and I will be aware in my logs
How can I patch behave.runner:Context.execute_steps() to continue after a failed step? Please explain
|
HINT FOR: Patch of
# — IN FUNCTION: Context.execute_steps()
…
If not passed:
…
# ORIGINAL-LINE: assert False, message. #< LINE OF INTEREST
assert self.scenario.continue_after_failed_step, message |
The tag @runner.continue_after_failed_step does not work when multiple step are called inside context.execute_steps
I have a simple feature file with which has a scenario with tag
@runner.continue_after_failed_step
The second step in the feature file uses context.execute_steps to call two steps.
When the first step fails the test does not continue to next step.
How can i make it execute all the steps in context.execute_step even if some step fails?
The text was updated successfully, but these errors were encountered: