-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Karate RuntimeHooks beforeScenario is not executed for Dynamic scenarios #1502
Comments
looks introed in #1453 - cc @joelpramos can either of you sort this out, this will take time for me to get to |
@joelpramos you probably have more context for this already, otherwise let me know I'll look into it.. |
Seems like on @ivangsa I can check this later in the week only, shouldn't be a major change. I haven't opened your project yet but will look into and add as a unit test for Karate. If you can do that beforehand it'd be great (maybe it already is mostly done). |
@joelpramos I attempted a fix which I have not tested: aa4ed47 wanted to make sure you were aware of |
Still few tweaks needed based on my unit tests. We are currently triggering the beforeScenario() for the background section (but not after scenario). For outline scenarios I'd suggest not to trigger beforeScenario() and afterScenario() for the background section. To me it's already a "before" concept to begin with. Those would be executed for each execution of Scenario Outline. The beforeStep() / afterStep() would still be executed in each step of the background section (and then for each step, for each execution, of scenario outline). Let me know if you're aligned @ptrthomas . |
@joelpramos if there is a background, the beforeScenario() should be executed no matter what scenario it is IMO. and once fired it shouldn't be executed. is that not how it is / should be ? |
The beforeScenario() is being executed for the background section; then beforeScenario() and afterScenario() are executed as expected for each iteration of Scenario Outline. Since dynamic scenarios "pre execute" the background section before and just reuse the results, the desired behavior is a decision we'll have to make as it will never be 100% consistent with "normal" scenarios in which background steps. My thinking is not executing beforeScenario() nor afterScenario() for the background section only. This might create issues for someone trying to get a perfect async scenario reporting to some reporting tool but my opinion before was already this is too complex and might as well deal with it once the root-level feature completes. Also if there's some pre-load of data which is then needed in the background section ... alternatively we could add beforeBackground() and afterBackground(), although not sure how hard it'll make it for "normal" scenarios. |
@joelpramos oh ok - if there is a background it should execute only once for a dynamic. agreed. I think you can go ahead, we are aligned. not something I use that much so I'm biased ;) |
@joelpramos and for a dynamic - we want the |
Correct @ptrthomas . So here's my proposal now that I'm thinking through the different use cases, let me know what you think.
|
@joelpramos yep this sounds great. IMO |
- adding beforeBackground() and afterBackground()
Opened PR #1508. I did not run all the unit tests - will review any test failures tomorrow. @ivangsa check out whether my unit test coverage on
|
1.0 released |
When running dynamic scenarios RuntimeHook#beforeScenario are not executed
This is the output of MyRuntimeHook
myproject.zip
The text was updated successfully, but these errors were encountered: