radish icon indicating copy to clipboard operation
radish copied to clipboard

Multiple tags not supported

Open randomcoder opened this issue 3 years ago • 3 comments

Important notices Before you add a new report, we ask you kindly to acknowledge the following:

[x] I have read the contributing guide lines at https://github.com/radish-bdd/radish/blob/master/.github/CONTRIBUTING.md

[x] I have read and respect the code of conduct at https://github.com/radish-bdd/radish/blob/master/.github/CODE_OF_CONDUCT.md

[x] I have searched the existing issues and I'm convinced that mine is new.

Describe the bug When a feature or scenario has more that one tag, only the first in the list is used.

Running with --tags tag_2 should run both scenarios as they should inherit all tags from from the feature but none are executed instead

Error: No feature or no scenario specified in at least one of the given feature files
You have specified a tag expression. Make sure those are valid and actually yield some Scenarios to run.

Running all scenarios gives output like this which shows only the first defined tag from the Feature and Scenarios are used

@tag_1
Feature: A simple feature

    @tag_4
    Scenario: A simple cucumber scenario outline - 1
    ....

    @tag_6
    Scenario: A simple cucumber scenario outline - 2
    ...

Environment and Version

  • OS (incl. terminal and shell used): Mac 11.4 zsh
  • Python Version: 3.8
  • radish Version (radish --version): 0.13.4

To Reproduce

@tag_1 @tag_2 @tag_3
Feature: A simple feature

    @tag_4 @tag_5
    Scenario: A simple cucumber scenario outline - 1
        Given I have 1 cucumbers in the basket
        When I add 4 cucumbers
        Then I have 5 cucumbers in the masket

    @tag_6 @tag_7
    Scenario: A simple cucumber scenario outline - 2
        Given I have 1 cucumbers in the basket
        When I add 4 cucumbers
        Then I have 5 cucumbers in the masket

Expected behavior All tags defined should be assigned to the feature and scenarios and allow filtering by any tag set

randomcoder avatar Jul 05 '21 10:07 randomcoder

I am fairly sure your problem is only how you add tags. radish allows you to add one tag per line (limitation of the parser)

If you change your example to:

@tag_1 
@tag_2 
@tag_3
Feature: A simple feature

    @tag_4 
    @tag_5
    Scenario: A simple cucumber scenario outline - 1
        Given I have 1 cucumbers in the basket
        When I add 4 cucumbers
        Then I have 5 cucumbers in the masket

    @tag_6 
    @tag_7
    Scenario: A simple cucumber scenario outline - 2
        Given I have 1 cucumbers in the basket
        When I add 4 cucumbers
        Then I have 5 cucumbers in the masket

It should work as you expect.

fliiiix avatar Jul 06 '21 06:07 fliiiix

Hmm, I thought I'd tried that but it seems to work so thank you for the work around.

Is it a big problem to handle the single line definition though? We have in the past used several tags per feature / scenario to provide finer grained control of the tests and having one tage a line rapidly fills the file up with tags and hinders readability somewhat.

randomcoder avatar Jul 07 '21 16:07 randomcoder

This is how it is supposed to work in radish.

But I see your point of having multiple tags per line and I don't see any harm in doing that. If it can be done is a clear maybe my naive approach to implement failed: https://github.com/radish-bdd/radish/pull/421 I will take an other look when I fixed the CI/CD stuff.

But feel free to poke around, I am open to merge and release something which works and does not break other stuff.

fliiiix avatar Jul 07 '21 19:07 fliiiix

also support for @tag: foo bar @tag2 would be useful

fliiiix avatar Feb 23 '23 10:02 fliiiix