Search code examples
javacucumbercucumber-jvm

Cant find multiple Cucumber Tags when executing Runner class


When I run the following Runner class the test fails saying it cant find the specified tags. When I specify any of the tags by themselves the test executes and passes.

Why can I only specify one tag at a time?

@RunWith(Cucumber.class)
@CucumberOptions(plugin = {
        "pretty", "com.cucumber.listener.ExtentCucumberFormatter:target/cucumber-reports/report.html"
}, glue = {
        "cars"
}, features = {
        "classpath:feature/",
}, tags = {"@edit-car", "@create-car", "@delete-car"})
public class RunnerTest {}

Error

None of the features at [classpath:feature/] matched the filters: [@edit-car, @create-car, @delete-car]

Solution

  • The semantics of tags are confusing. One of these has AND semantics, the other OR semantics and I can't remember which one.

    tags = {"@edit-car", "@create-car", "@delete-car"}
    tags = {"@edit-car, @create-car, @delete-car"}
    

    If you are on a recent version of Cucumber (> 2.0.0) consider using a single tag expression instead.

    tags = "(@cucumber or @gherkin) and not @zukini"