1

I tried to run a Cucumber test with multiple tags.

But got this error.

I am using Cucumber version 5.7.0.

How can i run multiple tags now?

import org.junit.runner.RunWith;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;


@RunWith(Cucumber.class)                
@CucumberOptions
(
        features = {"src/main/java/com/project1/features"},
        glue = {"com/project1/stepDefinitions"},
        plugin = {"pretty"},
        tags = {"@User1Login", "@User2Login"},
        monochrome = true
        )
1

2 Answers 2

4

In Cucumber 5.7.0 the support of tags is handled in different way so that expression(infix boolean expression) can also be used in the same way. You can pass the multiple tags like

@CucumberOptions(tags = "@smoke and @positive")
public class RunCucumberTest {}

Another way to manage the tags by JVM System Property

mvn test -Dcucumber.filter.tags="@smoke and @positive"

Option --scenario or pattern file.feature:line is a way to run a subset of scenarios

Ref: https://github.com/cucumber/cucumber-jvm/pull/1955

Here the Changelog of 5.7.0 https://github.com/cucumber/cucumber-jvm/blob/master/CHANGELOG.md

0

-Dcucumber.filter.tags="(@smoke or @dry)" You can also use -Dcucumber.filter.tags="(@smoke or @dry) and not @positive".

Add this to CucumberOption to run the tags from your test runner class: tags = "(@smoke or @dry)"

or

tags = "(@smoke or @dry) and not @positive"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.