Exception in thread "main" cucumber.runtime.CucumberException: No backends were found
Asked Answered
S

18

14

I am developing my Selenium-JVM framework with Cucumber and while running my first feature got below error.

Please help.

How did I launch the feature -

  1. Right click on feature file
  2. Select Run As -> Cucumber Feature

Immediate Exception -

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:78)
    at cucumber.runtime.Runtime.<init>(Runtime.java:67)
    at cucumber.runtime.Runtime.<init>(Runtime.java:63)
    at cucumber.api.cli.Main.run(Main.java:24)
    at cucumber.api.cli.Main.main(Main.java:16)

What I have in code -

Launcher.java -

package cucumber;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(format={"pretty","json:target/"} , features="/src/test/java/cucumber/features")
public class Launcher {

}

Feature file -

Feature: it works demo

  Scenario: First test
    Given this is my step
    When this is my second step
    Then this is my final step

List of Dependencies added to list -

cucumber-core-1.1.8
cucumber-html-0.2.3
cucumber-java-1.1.8
cucumber-junit-1.1.8
cucumber-jvm-deps-1.0.3
gherkin-2.12.2
hamcrest-all-1.3
junit-4.11
selenium-api-2.42.2
selenium-firefox-driver-2.42.2
selenium-java-2.42.2
selenium-remote-driver-2.42.2
selenium-support-2.42.2

My JVM - 1.7

Only this much is available in project.

Please help.

Sandrocottus answered 18/9, 2014 at 22:26 Comment(1)
Can you post your pom.xml fileAldon
G
16

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>
Grouch answered 10/10, 2016 at 6:39 Comment(2)
Also, the versions of cucumber have to be correct for your version of Java - I had to do an exclude group on 'io.cucumber' and 'info.cukes' when adding com.github.mkolisnyk:cucumber-runner, because it brought in an older versionAmye
Make sure all dependencies for Cucumber are the same version. Note that we are currently at v4 and counting. Also note that as of v2 the groupId changed from info.cukes to io.cucumber.Smug
H
15

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.

Hephzibah answered 28/9, 2014 at 19:41 Comment(2)
How to do this for gradle?Deviltry
add cucumber dependencies to your gradle build fileSmug
S
2

Used the latest and same version for all dependencies and it works fine.

<dependencies>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>6.11.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>6.11.0</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>6.11.0</version>
        </dependency>
    </dependencies>
Sheff answered 3/11, 2021 at 0:26 Comment(1)
It helped me with above version., thanks to youOsculum
H
1

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 :-)

Hesson answered 7/8, 2017 at 3:3 Comment(0)
D
1

You are not providing the path of the step definition class Add glue in the cucumber options may be it will help.

@RunWith(Cucumber.class) @CucumberOptions( 
    features ="Path of the feature file", 
    glue = {"path of step definition class or package "},
    format={"pretty","json:target/"},
    dryRun = true, 
    strict = true,      
    monochrome = true )
Degust answered 28/5, 2020 at 11:23 Comment(0)
D
1

Writing in 2020, though enough discussion has already gone on this topic. Still if it helps someone. For me the issue got resolved with same version of

  1. cucumber-java

  2. cucumber-junit

  3. cucumber-core dependencies snippet of my POM

    io.cucumber cucumber-java 6.4.0 io.cucumber cucumber-core 6.4.0 io.cucumber cucumber-junit 6.4.0 compile
Dogbane answered 13/10, 2020 at 13:5 Comment(0)
E
1

I got this same error message when trying to run a Cucumber feature file in Eclipse.

These steps worked for me:

Updated my pom.xml file with the latest and same version of the following libraries.

  • cucumber-junit - 1.2.6
  • cucumber-java - 1.2.6

Also I updated 'junit' to the latest version

Embrangle answered 17/2, 2021 at 10:10 Comment(0)
P
0

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

Piecework answered 1/11, 2017 at 14:25 Comment(0)
M
0

i had pom in my dependency for cucumber-java. Once i removed that worked fine

Messmate answered 28/5, 2020 at 9:19 Comment(0)
P
0
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-jvm-deps -->
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-jvm-deps</artifactId>
    <version>1.0.5</version>
    <scope>provided</scope>
</dependency>

Keep only three tags (groupId, artifactId and version) in your dependencies. Delete <scope> and other additional tags in pom.xml and then try.

Prosy answered 30/6, 2020 at 8:49 Comment(0)
O
0

I have updated my pom.xml file with the latest version of following libraries. It works for me.

  • junit
  • cucumber-java
  • cucumber-junit

Make sure you are using the correct version of junit, cucumber-java, cucumber-junit. It should not be like you are using some older version of junit and latest versions of cucumber junit and java. I have list down the dependencies which I have used. You can try these.

<dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13</version>
      <scope>test</scope>
</dependency>
<dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>6.7.0</version>
</dependency>
<dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>6.7.0</version>
</dependency>
Organist answered 25/9, 2020 at 9:43 Comment(0)
N
0

The error simply says that cucumber is not configured properly on your device. This can be because of missing dependencies or the dependencies are not loaded properly. Check for the dependencies first and then save all, close the editor, and then reopen it. Try to run again and check.

Nonrigid answered 7/4, 2021 at 3:26 Comment(1)
Instead of the descriptive answer, provide with code snippet or example for clean illustration of the answerFlogging
J
0

Removed Cucumber Core dependency from POM.XML it is working fine

Jeopardous answered 18/6, 2021 at 13:0 Comment(0)
G
0

Commenting in 2021. This might help someone. The issues is simple, cucumber groupid has been changed to >io.cucumber< so if you are still using >info cukes< you will be getting exceptions. That is why when you update your cucumber java to the latest it solves the issue bc the latest groupid comes as io.cucumber. You can as well change all the groupid info cukes in your pom.xml to io.cucumber. This will solve the issue

Gaullism answered 19/6, 2021 at 16:24 Comment(0)
B
0

Errors on running Cucumber Feature Exception in thread "main" cucumber.runtime.CucumberException: No backends were found. Please make sure you have a backend module on your CLASSPATH.

Solution

Most probably this means that your cucumber-java version and java version on your machine is not compatible with each other. First, check Java Version on your machine by going through this article How to check Java/JDK Version Installed on your Machine.

On my machine, I have Java 1.8.0 with cucumber-Java8-1.2.5 and it did not work. When I degraded my cucumber java version to cucumber-Java-1.2.5, it worked fine for me. Just make sure that first, you remove the cucumber-java which did not work for you from Project build path >> Libraries and then add new.

Blindage answered 1/9, 2022 at 11:20 Comment(0)
M
0

It can also be caused by having 2 backend: for example:

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>7.8.0</version>
        <scope>test</scope>
    </dependency>

and

    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

Also make sure you have compatible versions

Monocycle answered 11/10, 2022 at 9:38 Comment(0)
S
-1

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.

Sylvestersylvia answered 4/6, 2017 at 22:28 Comment(0)
P
-1

Adding the following dependency I got resolved this issue

   <dependency>
       <groupId>io.cucumber</groupId>
       <artifactId>cucumber-java</artifactId>
       <version>4.2.6</version>
   </dependency>
Pinafore answered 27/3, 2019 at 15:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.