cucumber-jvm: Tags at the examples block are not treated as actual tags in scenario
It seems as though tags specified at an examples block are not treated as such when being assigned to a scenario:
Scenario Outline: Test Stuff
Given foo
When bar
Then fizz
@myTag
Examples:
| col a |
| data |
public void before(Scenario scenario){
for(String tag : scenario.getSourceTagNames()){
System.out.print("Tag: " + tag);
}
}
This ultimately prevents us from creating Hooks based on tagged Example blocks. Perhaps there is an alternative?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (8 by maintainers)
Ok, @williamlabrum its a bug. But it is not as easy as that the tags on examples tables are totally ignored, they are lost when performing tag filtering.
If you remove
tags = { "~@in-progress", "~@skip"}for the@CucumberOptionannotation of your runner class, you will see that the@myTagtag will exist on the scenario from the examples table in question. If you change the tag value totags = { "@myTag"}in the@CucumberOptionyou will see that the scenario from the examples table in question will be executed, so when filtering on the tags it will be selected, but then when it is executed, the scenario will no longer have the@myTagtag.I have not tracked down where the bug is located, but as it is related to tag filtering, the possibility is that it is located in the gherkin library, and in that case the bug is likely to remain until the current gherkin library (gherkin2) is replaced by the gherkin3 library (since no new releases of gherkin2 is planned).