Getting Error while executing Cucumber project | Selenium Forum

Getting Error while executing Cucumber project

D
dipu.sandeep Post on 09/03/2020

Getting below error while executing cucumber project. Attaching code as well. Please suggest!

 

Mar 08, 2020 11:18:08 PM io.cucumber.junit.Cucumber <init>
WARNING: By default Cucumber is running in --non-strict mode.
This default will change to --strict and --non-strict will be removed.
You can use --strict or @CucumberOptions(strict = true) to suppress this warning

[31mFailed scenarios:[0m
[31mfile:///C:/Users/Praveen/eclipse-workspace/Learning-java/CucumberProject/src/test/resources/com/qtpselenium/rediff/Login.feature:23[0m# Logging into Rediff Money

1 Scenarios ([31m1 failed[0m)
4 Steps ([31m1 failed[0m, [36m3 skipped[0m)
0m0.328s


io.cucumber.core.exception.CucumberException: class com.qtpselenium.steps.GenericSteps doesn't have an empty constructor. If you need dependency injection, put cucumber-picocontainer on the classpath
at io.cucumber.core.runtime.ObjectFactoryServiceLoader$DefaultJavaObjectFactory.cacheNewInstance(ObjectFactoryServiceLoader.java:133)
at io.cucumber.core.runtime.ObjectFactoryServiceLoader$DefaultJavaObjectFactory.getInstance(ObjectFactoryServiceLoader.java:121)
at io.cucumber.java.JavaStepDefinition.execute(JavaStepDefinition.java:27)
at io.cucumber.core.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:63)
at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:64)
at io.cucumber.core.runner.TestStep.run(TestStep.java:49)
at io.cucumber.core.runner.PickleStepTestStep.run(PickleStepTestStep.java:46)
at io.cucumber.core.runner.TestCase.run(TestCase.java:51)
at io.cucumber.core.runner.Runner.runPickle(Runner.java:66)
at io.cucumber.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:149)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:83)
at io.cucumber.junit.FeatureRunner.runChild(FeatureRunner.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:185)
at io.cucumber.junit.Cucumber.runChild(Cucumber.java:83)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at io.cucumber.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:219)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
Caused by: java.lang.NoSuchMethodException: com.qtpselenium.steps.GenericSteps.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.getConstructor(Class.java:1825)
at io.cucumber.core.runtime.ObjectFactoryServiceLoader$DefaultJavaObjectFactory.cacheNewInstance(ObjectFactoryServiceLoader.java:128)
... 32 more

 

S

Instructor

Support Team Reply on 09/03/2020

The error is at GenericSteps under the package com.qtpselenium.steps.

Please try debugging the code and then check weather the data is coming in the right way or not.

D
dipu.sandeep Reply on 10/03/2020

I have tried without much luck

Why it is complianing for empty constructor


io.cucumber.core.exception.CucumberException: class com.qtpselenium.steps.GenericSteps doesn't have an empty constructor. If you need dependency injection, put cucumber-picocontainer on the classpath

D
dipu.sandeep Reply on 10/03/2020

Also this error "Caused by: java.lang.NoSuchMethodException: com.qtpselenium.steps.GenericSteps.<init>()"

Is there any problem with project setup or dependecy?

D
dipu.sandeep Reply on 11/03/2020

Team,

Can you please suggest the wayforward..

Related Post