I am working with cucumber
and selenium
project and I am trying to run the test by a Junit Test Runner
. Here is the complete code (make sure you have lombok in your IDE). And here is my test runner
:
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"src/test/resources/features" },
monochrome = true,
plugin = {
"pretty",
"com.cucumber.listener.ExtentCucumberFormatter:target/report.html"
},
tags = {"@all"},
glue = {"stepDefinitions"}
)
public class TestRunnerJUnit {
@AfterClass
public static void setup() {
Reporter.setSystemInfo("User Name", System.getProperty("user.name"));
Reporter.setSystemInfo("Time Zone", System.getProperty("user.timezone"));
Reporter.setSystemInfo("Machine", "Windows 10" + "64 Bit");
Reporter.setTestRunnerOutput("Sample test runner output message");
}
}
The point is, when i run the test using the test runner, it finds the feature file, but it does not find any Scenario inside it. Here is the output of the run:
@all
Feature:
As a customer, I should be able to register for insurance.
0 Scenarios
0 Steps
0m0.000s
if i run the test directly using the feature file (by right click on it Run as Cucumber
then it works well. But, i need to run my test by test runner)
I had a chance to pull your code base and look into the code. the issue you are running into is something to do with extent library. you are providing feature name in a new line and which extent library can't understand that. write feature name in same line and it should solve your problem
Feature: As a customer, I should be able to register for insurance.
I also suggest you to use newer version of cucumber (Cucumber-JVM v4+) libraries which have concurrent execution support( under single JVM) and current library which you are using going to span up multiple JVM instances depending on your configuration