Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cant run feature in Cucumber

Im having issues running a feature in Cucumber, the feature is very basic as it's from a tutorial.

It is not defined and is as follows:

Feature: Proof that my concept works

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

My Cucumber runner class is as follows:

 package cucumber;
 import org.junit.runner.RunWith;
 import cucumber.api.junit.Cucumber;

 @RunWith(Cucumber.class)
 @Cucumber.Options(
    format = {"pretty", "json:target/"},
    features = {"src/cucumber/"}
    )
 public class CucumberRunner {

 }

Also the external .jar files that I have in the project are as follows:

image

The exception that I'm getting is:

Exception in thread "main" cucumber.runtime.CucumberException: Failed to instantiate public cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader) with [cucumber.runtime.io.MultiLoader@75d837b6]

I've tried to look around online for the solution to this problem but have not had any luck.

I've also discussed with the OP of the tutorial and I'm still awaiting feedback but it has been a while.

like image 416
dhali Avatar asked Sep 15 '14 11:09

dhali


People also ask

Why a Cucumber feature does nothing?

As, when you open a feature file in Eclipse and right-click, then you do not find an option 'Run As->Cucumber Feature', it appears that your Eclipse do not have the required Cucumber Eclipse Plug-in. You can install this plug-in using following steps: Launch Eclipse and navigate to 'Help->Install New Software'.


1 Answers

I ran into a similar issue and got the same error as you did.

Firstly mention the path to the feature file features = {"src/cucumber/myfile.feature"} Anyway, that didn't cause the error.

To just run your Cucumber runner class, all the dependencies you need are

cucmber-junit cucumber-java and junit.

I had an additional cucumber-guice which was creating the problem and once I removed it, the error went away and runner was executed successfully.

From the link to the image you have mentioned it looks like you are not using cucumber-guice but still I would recommend you remove other unnecessary cucumber dependencies and try again.

like image 94
LINGS Avatar answered Sep 29 '22 09:09

LINGS