radish-bdd / radish

Behavior Driven Development tooling for Python. The root from red to green.
https://radish-bdd.github.io
MIT License
181 stars 49 forks source link

Multiple tags not supported #420

Closed randomcoder closed 1 year ago

randomcoder commented 3 years ago

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

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

fliiiix commented 3 years ago

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.

randomcoder commented 3 years ago

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.

fliiiix commented 3 years ago

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 commented 1 year ago

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