Tags at the examples block are not treated as actual tags in scenario
See original GitHub issueIt 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?
Issue Analytics
- State:
- Created 8 years ago
- Comments:17 (8 by maintainers)
Top Results From Across the Web
cucumber hooks in example tags - Stack Overflow
I want to print "@example_tag" in output. used java code as @Before public void beforeScenario (ScenarioOutline ScenarioOutline) { examples = ( ...
Read more >How to Get the Most Out of Cucumber Tags - Coveros
Tagging Basics. Cucumber provides a simple method to organize features and scenarios by user determined classifications.
Read more >Cucumber Reference - Cucumber Documentation
Tags are inherited by child elements. Tags that are placed above a Feature will be inherited by Scenario , Scenario Outline , or...
Read more >Filter on tag of scenario outline example - SmartBear Community
I only seem to be able to retrieve the tags for the entire outline and not for 1 example. Thanks! Solved!
Read more >Best practices for tags and tag managers - web.dev
Tags are often created by following guidance provided by a third-party vendor. If it is unclear what a vendor's code does—consider asking ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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@CucumberOption
annotation of your runner class, you will see that the@myTag
tag will exist on the scenario from the examples table in question. If you change the tag value totags = { "@myTag"}
in the@CucumberOption
you 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@myTag
tag.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).
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.