Exception in thread “main” cucumber.runtime.CucumberException: No backends were found

久未见 提交于 2019-11-29 09:31:24

Make sure you're adding below dependencies for Maven project:

You can replace version to the latest or the required version:

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.0</version>
    </dependency>

This error is thrown when no 'backends' are found on the classpath. There is a 'backend' for each supported language (e.g. cucumber-java, cucumber-groovy etc.)

It's probably a classpath error, although if cucumber-core and cucumber-java are in the same location that does seem strange.

You can try the cucumber-java-1.2.4 at https://mvnrepository.com/artifact/info.cukes/cucumber-java/1.2.4.

I found that trying a previous version of the same JAR file worked for me. I guess this may solve for other people as well. In case it does not, please add another answer.

Let me know if it worked for you and saved some valuable time :-)

Here is the fix: in eclipse projects add the following in the .project file

<buildSpec>
  ...
  <buildCommand>
	<name>cucumber.eclipse.steps.jdt.stepsBuilder</name>
	<arguments>
	</arguments>
  </buildCommand>
</buildSpec>
<natures>
  ...
  <nature>cucumber.eclipse.steps.jdt.stepsNature</nature>
</natures>

If this did not fix the issue, add the dependency

cucumber-java

in the project classpath or change the version of the jar to latest or n-1

Bryan Houder

I encountered this same error message when trying to run a Cucumber feature file in Eclipse ("No backends were found. Please make sure you have a backend module on your CLASSPATH").

What fixed it for me was going into my pom.xml and changing the cucumber-java and cucumber-junit versions away from 1.2.5 (per their documentation) to 1.2.0.

I'm not 100% sure if I'm ignoring a real issue by doing this or not. Here is more information about my setup:

  • Windows 10
  • Eclipse Neon (4.6.0)
  • Apache Maven 3.5.0
  • Java 1.8

I verified via quick commands that java and maven are installed successfully and running on my machine. I also verified that Maven pulled in the cucumber-java, and cucumber-core jars in my Eclipse project. Odd.

Adding the following dependency I got resolved this issue

   <dependency>
       <groupId>io.cucumber</groupId>
       <artifactId>cucumber-java</artifactId>
       <version>4.2.6</version>
   </dependency>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!