Passing tags in Runner Class Dynamically #2219
Replies: 1 comment 2 replies
-
You're currently using Instead if you upgrade to JUnit 5, and switch to using the You can find a minimal example project in the cucumber-java-skeleton. Alternatively, you can use a Maven Profile (or the Gradle equivalent) to set |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey Everyone,
I am trying to execute my runner class by accepting tags from a .properties file. However I am unable to do this as cucumber thinks I haven't specified any tags and runs all my tests. I have given below the Runner class and configuration reader class which reads the values from properties.file. How can I resolve this?
Runner class:
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import //ConfigurationReader;
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/resources/features",
glue = "//my Stepdefenitions",
dryRun = false,
)
public class CukesRunner {
static {
String tags = ConfigurationReader.getTags();
if (tags != null && !tags.isEmpty()) {
System.setProperty("cucumber.filter.tags", tags);
}
}
}
Configuration Reader:
public class ConfigurationReader {
private static Properties properties = new Properties();
}
Beta Was this translation helpful? Give feedback.
All reactions