-
-
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
Hooks for Scenario Outlines don't work #210
Comments
Whoops, seems this is a duplicate of #209. Didn't see that one until now. Sorry. |
Np - closing this. Your comments are valuable in fixing #209 anyway! |
gisode
pushed a commit
to gisode/cucumber-jvm
that referenced
this issue
Feb 21, 2012
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
mpkorstanje
pushed a commit
that referenced
this issue
Oct 4, 2019
mpkorstanje
pushed a commit
that referenced
this issue
Oct 4, 2019
mpkorstanje
pushed a commit
that referenced
this issue
Oct 4, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Given a Scenario Outline with some Examples.
And a @before hook matching the tag @tag
Given I add @tag to the Scenario Outline like so:
When I run it
Then the before-hook is NOT executed.
After digging in the code I found that it should work when @tag is added like so:
But it doesn't either and here is why:
When the
FeatureBuilder.examples()
method is given the GherkinExamples
object containing the correctly parsed tag, it simply passes the reference to it into the currentCucumberScenarioOutline
which builds a newCucumberExamples
instance that in turn simply stores the reference.Later in
CucumberExamples.createExampleScenarios()
the tags are taken from the same GherkinExamples
instance whose reference was stored earlier and put into the newly created scenario for the current example. At that point, however, the List within the GherkinExamples
object containing the tags is empty, because that List is cleared ingherkin.formatter.FilterFormatter.replay()
(examplesTags.clear();
currently at line 189).The bug here is that Gherkin passes an object into the
Formatter
implementation - theFeatureBuilder
- even though it is going to modify it later. Or thatFeatureBuilder
isn't prudent enough to make a copy of all objects that it is given.I can't see how this can be fixed easily. For the project I use this in I guess I'll have FeatureBuilder make a copy of the Examples object, which is an ugly hack, oh well.
As an aside, I find it confusing that the tags must be added to the Examples section. I had expected that the example scenarios created at runtime would inherit all the tags from the Scenario Outline.
The text was updated successfully, but these errors were encountered: