-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
@WithJunitRule executes rule for every scenario #118
Comments
This is correct behaviour if I correctly understand your issue. |
So in other words in Cucumber everything which is in glue package is considered to be used in scenario execution while in Junit it is limitted to test class which can cause some confusions but this is how Cucumber works |
Yep, that's right. I understand that. This behavior was not fully clear to me when reading the documentation. In the demo app, you inject the scenario holder for compose into one of the step classes which made me think that this is how it works |
Demo example is very simple however as lifecycle of scenario execution ia a bit different there is no correlation between injecting rules and executing them. Currently is not possible to achieve what you want but in general this should be done by specifing some filter for scenario similarily as in But as this is not currently implemented for |
Alright, thanks. Do you think there will ever be a way to use rules for single scenarios? For the user creation case, I could call a static function in the step definition which is no problem, but for rules like Can you give an example of what you mean by "some filter for scenario similar as in |
AS mentioned in
and then
and this So similar mechasim could be implemented for |
It would be great if there is scenario support for the |
We can keep it open until PR will be created |
Thanks a lot for the fast response @lsuski |
Sure, you can support by creating a PR with tag expression support in |
With version 7,14,0 (not released yet) you will be able to specify tag expression in |
👓 What did you see?
When using a class annotated with
@WithJunitRule
that contains a rule it gets executed for each scenario.✅ What did you expect to see?
I only expect the step classes that "inject" the rule in the constructor to execute the rule
📦 Which tool/library version are you using?
We are running instrumented tests on Android using test orchestrator
"io.cucumber:cucumber-android" version 4.10.0
🔬 How could we reproduce it?
Rule example:
This rule is not injected anywhere, but it still gets executed for each scenario
The text was updated successfully, but these errors were encountered: