@Suite
@SuiteDisplayName("NAME")
@IncludeEngines("cucumber")
@SelectClasspathResource("cucumber/tests")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "cucumber.tests")
@CucumberOptions(tags = "not @IGNORE")
public class RunCucumberTests {}
This was my pervious configuration where the tag does not work
@IncludeEngines("cucumber")
@SelectClasspathResource("cucumber/tests")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "cucumber.tests")
@CucumberOptions(tags = "not @IGNORE")
@RunWith(Cucumber.class)
public class RunCucumberTests {}
After changing it this configuration it works. Does anyone knows why? How could I use suite and CucumberOptions together.
You can not use @CucumberOptions
in combination with @Suite
. The former is used for JUnit 4, the latter part of JUnit 5.
The @Suite
annotation starts JUnit 5 declarative test suite. This means that you have to select the tests to execute using JUnit 5 concepts.
To target specific tags using the JUnit 5 suite, you have to use the @IncludeTags
or @ExcludeTags
annotations. For example:
package io.cucumber.skeleton;
import org.junit.platform.suite.api.ConfigurationParameter;
import org.junit.platform.suite.api.ExcludeTags;
import org.junit.platform.suite.api.IncludeEngines;
import org.junit.platform.suite.api.SelectClasspathResource;
import org.junit.platform.suite.api.Suite;
import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME;
@Suite
@IncludeEngines("cucumber")
@SelectClasspathResource("io/cucumber/skeleton")
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "io.cucumber.skeleton")
@ExcludeTags("IGNORE")
public class RunCucumberTest {
}
Note that these are JUnit 5 tags, and do not include the @
symbol that Cucumber tags include.