2

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

@RunWith(Cucumber.class)
@CucumberOptions(
        format = {"pretty", "html:target/cucumber"},
        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.

2
  • Could you please add the code where the Exception occurs?
    – Marit
    Jan 19, 2018 at 10:20
  • Was there a resolution to this? I am having the same issue.
    – Dawn
    Sep 5, 2018 at 13:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.