I am trying to run a BDD test with cucumber in a Maven project.
When I try to run BDDdemo.feature
, I get the following error
Exception in thread "main" cucumber.runtime.CucumberException: No backends were found. Please make sure you have a backend module on your CLASSPATH.
at cucumber.runtime.Runtime.<init>(Runtime.java:81)
at cucumber.runtime.Runtime.<init>(Runtime.java:70)
at cucumber.runtime.Runtime.<init>(Runtime.java:66)
at cucumber.api.cli.Main.run(Main.java:35)
at cucumber.api.cli.Main.main(Main.java:18)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)
Environments
openjdk version : 13.0.1
Apache Maven : 3.6.3
TestNG : 6.14.3
cucumber : 1.2.6
IDE : IntelJ IDEA
dependencies
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.6</version>
<!--<type>pom</type>-->
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.6</version>
<!--<type>pom</type>-->
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.6</version>
<!--<type>pom</type>-->
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>5.3.0</version>
</dependency>
I have tried the all solutions in stack overflow regarding this issue. But nothing worked for me.
Can anyone help me with this ?
I'm assuming that, according to your pom.xml
snippet, you are using TestNG and Junit. Thus, you need to add both cucumber-testng (it's already there) and cucumber-junit (it's missing) as cucumber backends. Please consider adding this other dependency entry to dependencies section on your pom.xml
:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.6</version>
</dependency>
PS: all the dependencies you listed seems to be test-scoped, so, consider add <scope>tests</scope>
to each one of them to avoid unnecessarily adding those libraries to your final package (in case you are packaging a JAR).