I can my from my runner class without any problem. Here is my Runner-class:

@RunWith(.class)
@CucumberOptions(
        format = {"pretty", "html:target/"},
        glue = {"ru.mts.m2m.b2b.stepDefinition"},
        features = "./src/test/resources/features/Filter.feature")
public class RunFilterTest {
    @BeforeClass
    public static void setUp(){
        Application.getInstance().setWindowSize(1920, 1080);
    }

    @AfterClass
    public static void tearDown(){
        Application.getInstance().closeBrowser();
    }
}

As you can see, I’m using JUnit.

When I’m trying to run tests from my feature file, I get fails and such a message in stacktrace:

cucumber.runtime.CucumberException: Failed to instantiate class ru.mts.m2m.b2b.stepDefinition.FilterDefinition
at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:47)
  at cucumber.runtime.java.DefaultJavaObjectFactory.getInstance(DefaultJavaObjectFactory.java:33)
  at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38)
  at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37)
  at cucumber.runtime.Runtime.runStep(Runtime.java:300)......

So, I really can’t understand what’s wrong in my above code. I’ve tried many things, plz help me.



Source link https://sqa.stackexchange.com/questions/25179/cant-run-tests-from-cucumber-feature-file-cucumber-runtime-cucumberexception

LEAVE A REPLY

Please enter your comment!
Please enter your name here