1

I need to pass the Cucumber tagname from an external file (run.yml) as below

execution:
  tag: '@Regression'

How to pass to runner class. My current runner class is as below and execution doing from meven or directly from junit

@RunWith(Cucumber.class)
@CucumberOptions(
        tags = "@Regression" ,
        features = "features",
        glue = "io/automation/gluecode",
        plugin = {"json:target/cucumber.json"}
)
public class TestRunner {
}

I tired to implement with the solution provided here, but it is not working in latest cucumber

  RuntimeOptions runtimeOptions = new RuntimeOptions(new ArrayList(Arrays.asList(argv)));
        MultiLoader resourceLoader = new MultiLoader(this.getClass().getClassLoader());
        ResourceLoaderClassFinder classFinder = new ResourceLoaderClassFinder(resourceLoader, this.getClass().getClassLoader());
        Runtime runtime = new Runtime(resourceLoader, classFinder, this.getClass().getClassLoader(), runtimeOptions);

unable to locate MultiLoader class

Fayis K
  • 61
  • 7
  • How are you launching Cucumber? Specifically, how does your `TestRunner` class get executed? Maven? Gradle? Something else? – M.P. Korstanje Mar 09 '23 at 14:41
  • I am running my RunnerClass from maven or by Junit – Fayis K Mar 09 '23 at 14:42
  • Did you try passing the property `mvn test -Dcucumber.filter.tags=@Regresion`? – M.P. Korstanje Mar 09 '23 at 19:48
  • @M.P.Korstanje I am able to execute with cli cucumber commands, but I need to pass the tags from a yml file, where I am adding all execution details and which need to execute via maven and Junit run. – Fayis K Mar 15 '23 at 05:33
  • Cucumber only looks at system, environment and property files. I reckon you need to see how you configure that from your yaml file. Shouldn't be too difficult if the yaml file is for a ci system. – M.P. Korstanje Mar 15 '23 at 08:34

0 Answers0