JUnit Runner class is unable to locate the Steps definition file with project structure Below: src/test/java/com/testSteps/TestSteps.java and JunitRunner class under src/test/java/com/cucumbertestrunner/TestRunner
[ Following is the syntax of JUnitRunner class
package com.cucumbertestrunner;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(features ={"src/test/resources/TestSteps.feature"},
glue ={"src/test/java/com"},strict = true,plugin = {"pretty", "html:target/cucumber"})
public class TestRunner {
}
Running the TestRunner.java as JUnit Test shows following exception:
at cucumber.api.PendingException: TODO: implement me at cucumber.runtime.junit.JUnitReporter.addFailure(JUnitReporter.java:134) cucumber.runtime.junit.JUnitReporter.addFailureOrIgnoreStep(JUnitReporter.java:122) at cucumber.runtime.junit.JUnitReporter.result(JUnitReporter.java:91) at cucumber.runtime.Runtime.runStep(Runtime.java:281) at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44) at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39) at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44) at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91) at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63) at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70)
Please Help.
Please look into the TestSteps class, and what the step methods contain. Throwing the PendingException is the default implementation for the steps. You have to actually implement what the step should do.
Apart from that, I suggest to setthe location of the steps as a package, because steps are defined in classes and those have to be located in the classpath.
For example
glue = {"com.teststeps"}
I also suggest to refer to the feature files in the classpath, as they are located in the resources folder
features = {"classpath:TestSteps.feature}