0

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

[(Project Hierarchy is attached Below) 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.

Asif
  • 39
  • 2
  • 8

1 Answers1

1

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}
Gerald Mücke
  • 10,724
  • 2
  • 50
  • 67
  • I tried exactly your mentioned solution "@CucumberOptions(features ={"classpath:TestSteps.feature"}, glue = {"com.teststeps"}," BUT still same issue – Asif Apr 27 '16 at 07:36
  • Check the content of the TestSteps, I assume the PendingException is thrown by the step itself and it's not due to your set up. I edited the answer accordingly. – Gerald Mücke Apr 27 '16 at 08:05
  • Yeas it was by mistake , One of the methods in the Test Steps file was throwing Pending Exception. Many Thanks for your help :) – Asif Apr 27 '16 at 09:30