question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tags at the examples block are not treated as actual tags in scenario

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
brasmussoncommented, Apr 10, 2015

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 to tags = { "@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).

0reactions
lock[bot]commented, Oct 25, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found