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

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

    public static void tearDown(){

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.