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
Improve exception checking in Behat tests #27002
Improve exception checking in Behat tests #27002
Conversation
…e no exception can be ignored anymore
…, and exception can be tested in the same step they were thrown
…h ignored duplicated creations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior is correct but the logic is inserted into the AbstractDomainFeatureContext which becomes bigger and bigger. Should we isolate the logic in a dedicated class or trait?
@matks I thought about it, but it means we have to always associate this other Context when we use the lastException So if we forget to set it in the suite contexts then the whole feature is ignored and we go back to the previous state where exception were ignored sometimes At least with this if you use We could split the abstract into several classes or use traits, but I'm not sure it brings much value It can be refactored later if needed that's not the point of this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then OK for me ✅
Thank you @jolelievre |
The problem is that with this some failing commands could be ignored if we don't check the exception in the next step so we added a manual step to check that no exception was thrown But it's not convenient to add this step everytime and we could forget some
This PR adds an automatic management of this exception checking, it stores any exception that might have been thrown after each step, and in the next step it ensure that this exception has been correctly asserted (and therefore clean) if not it means the exception was not expected so we consider the test as failed With this new method no exception can be ignored now even they were wrongly caught
This change is