-
Notifications
You must be signed in to change notification settings - Fork 38
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
Continue on failure does not work if assert is wrapped in a method #124
Comments
Works as expected with given versions, remaining steps in scenario is executed even when exception happens in another function. Can you please share a project to replicate this ? |
My bad, it breaks the rest of the step, so if there is a table attached to it, it breaks that loop as well. Kind of inconvenient though. |
That is the expected behaviour of @continue_on_failure. If any exception occurs in a step marked as @continue_on_failure, it will continue to run other step and the remaining part from the point of exception in the current step will not be executed. |
I still see it as an impediment for data-driving. Why is the expected behavior to break the step especially in cases of assertion errors? |
The What you seek is perhaps a step implementation to continue even if there is a failure. I think you could benefit from a "soft assert", where your step implementation could accumulate all the failures and return back only after implementing it. Please see how we do soft assert in our tests (the example is in java, but it should be easy enough to do something similar in python) - https://github.com/getgauge/gauge-tests/blob/master/src/test/java/com/thoughtworks/gauge/test/implementation/ProjectInit.java#L49-L60 |
thanks @sriv, I used the delayed_assert package with expect(). |
I have a step that calls a method to do the verification. When the assert fails in the method, it throws an exception and it's not caught by the continue on failure on the step level.
Steps to reproduce
Result: Scenario DOES NOT continue on failure
Expected: Assertion error should be handled.
The text was updated successfully, but these errors were encountered: