I have seen the posts -
How to run cucumber file from command line
Cucumber java project without maven - how to run from command prompt if i am having Runner class
But the solutions given there are not very clear.
My CucumberRunner.java looks like -
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/resources/features",
tags="@Regression",
monochrome = false,
plugin = {"pretty",
"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",
"timeline:test-output-thread/",
"json:target/cucumber-reports/jsonReports/Cucumber.json",
"html:target/cucumber-reports/Cucumber.html"}
)
public class CucumberRunner {
}
Unfortunately because of security reasons I can not install maven on Linux machine. So I want to run this CucumberRunner file from CLI.
As suggested in the previous posts I tried below in my Cucumber class
public class CucumberRunner {
public static void main(String[] args){
Main.main(new String[]{"-g", "src/test/java/stepdefinitions", "src/test/resources/features/Validate.feature"});
}
}
But it gives me exception
Exception in thread "main" java.lang.NoClassDefFoundError: io/cucumber/core/cli/Main
at CucumberRunner.main(CucumberRunner.java:29)
Caused by: java.lang.ClassNotFoundException: io.cucumber.core.cli.Main
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
... 1 more
But This also doesn't give any solution to run on the basis of Cucumber tags.
Any solution or pointer is appreciated.
Kind Regards,
Abhi