Unable to run the feature file

8,559 views
Skip to first unread message

gaura...@gmail.com

unread,
Mar 24, 2016, 8:57:39 AM3/24/16
to Cukes
Hi All,

I am new to cucumber. I am trying to start a project using cucumber. When I run the .feature file, I am getting an error. I tried googling the issue but didn't get any thing.

Please find below the details :

Feature File :

Feature:Proof of concept that my framework works

  Scenario:My First Test
    Given I naviagted to the zoo website
    When I click on adoption link
    Then I check to see that no animals are available


Runner File :
@RunWith(Cucumber.class)
@CucumberOptions(
format={"pretty", "json:target/cucumber.json"},
features = {"src/cucumber/features"},
glue ={"stepDefinitions"}
)
public class CucumberRunner {


}


Error :

Exception in thread "main" cucumber.runtime.CucumberException: Failed to instantiate public cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader) with [cucumber.runtime.io.MultiLoader@1b0d33c]
at cucumber.runtime.Reflections.newInstance(Reflections.java:44)
at cucumber.runtime.Reflections.instantiateSubclasses(Reflections.java:30)
at cucumber.runtime.Runtime.loadBackends(Runtime.java:98)
at cucumber.runtime.Runtime.<init>(Runtime.java:65)
at cucumber.api.cli.Main.run(Main.java:35)
at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at cucumber.runtime.Reflections.newInstance(Reflections.java:41)
... 5 more
Caused by: java.lang.NoSuchMethodError: cucumber.runtime.io.ClasspathResourceLoader.getAnnotations(Ljava/lang/String;)Ljava/util/Collection;
at cucumber.runtime.java.ClasspathMethodScanner.findCucumberAnnotationClasses(ClasspathMethodScanner.java:75)
at cucumber.runtime.java.ClasspathMethodScanner.<init>(ClasspathMethodScanner.java:23)
at cucumber.runtime.java.JavaBackend.<init>(JavaBackend.java:30)
... 10 more


Please help me in this.

Thanks & Regards,
Gaurav Sharma

Thomas Sundberg

unread,
Mar 24, 2016, 10:24:01 AM3/24/16
to cu...@googlegroups.com
You are missing a dependency. Or something similar.

Please share how you try to invoke Cucumber. Which dependencies do you have?

Are you able to clone/download

https://github.com/cucumber/cucumber-java-skeleton

and get it working?

Cheers,
Thomas

--
Thomas Sundberg
M. Sc. in Computer Science

Mobile: +46 70 767 33 15
Blog: http://thomassundberg.wordpress.com/
Twitter: @thomassundberg

Better software through faster feedback

Join me for a Selenium kickstart in Timisoara, Romania in April.
http://mozaicworks.com/public-trainings-and-workshops/selenium-webdriver-test-automation-for-web-applications/

Interested in a BDD Kickstart in Stockholm?
https://cucumber.io/events/bdd-kickstart-stockholm-16

gaura...@gmail.com

unread,
Mar 25, 2016, 1:32:00 AM3/25/16
to Cukes, t...@kth.se
Hi Thomas,

I am not using the dependency mentioned by you. I have downloaded the Cucumber dependency from "http://cucumber.github.com/cucumber-eclipse/update-site".

I am running the feature file as "Cucumber Feature".

Thanks,
Gaurav Sharma

Björn Rasmusson

unread,
Mar 26, 2016, 5:16:43 AM3/26/16
to Cukes, t...@kth.se
gaura...@gmail.com wrote:
Hi Thomas,

I am not using the dependency mentioned by you. I have downloaded the Cucumber dependency from "http://cucumber.github.com/cucumber-eclipse/update-site".
Hi,

AFAIK the cucumber-eclipse update site does only download the Eclipse plugin. You also have to download the Cucumber implementation and add it to your project in Eclipse. See https://cucumber.io/docs/reference/jvm, or start from https://github.com/cucumber/cucumber-java-skeleton/ as Thomas suggested.
 

I am running the feature file as "Cucumber Feature".

Running the feature this way does not use the Runner File you mentioned. The Runner File would be used if you selected it and used the "Run as JUnit test" menu.

Regards
Björn

Gaurav Sharma

unread,
Mar 29, 2016, 3:20:17 AM3/29/16
to cu...@googlegroups.com
Hi All,

I tried all the possible ways I could search in google, but it is not
helping me.
Please help me in getting it run.

Your help will be very much appreciated.

Thanks,
Gaurav Sharma
> --
> Posting rules: http://cukes.info/posting-rules.html
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Cukes" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cukes/_COGcnATQug/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> cukes+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Roberto Lo Giacco

unread,
Mar 29, 2016, 11:03:41 AM3/29/16
to Cukes

Il giorno martedì 29 marzo 2016 09:20:17 UTC+2, Gaurav Sharma ha scritto:
Hi All,

I tried all the possible ways I could search in google, but it is not
helping me.
Please help me in getting it run.

Your help will be very much appreciated.

Have you ever used Eclipse before or is this your very first time with Java?

Do you know or have you ever used Maven? If yes, then add the cucumber-java dependency to your POM.

Do you know how to add a dependency to an Eclipse project? If so add the cucumber-java dependency to your Eclipse project.

A good starting point would be https://cucumber.io/docs/reference/jvm#java, 3rd result querying Google for "cucumber java startup"

Gaurav Sharma

unread,
Mar 30, 2016, 1:44:24 AM3/30/16
to cu...@googlegroups.com
Hi,

I am using Eclipse since last 3 years. I have extensively used it for
Selenium. Now I want to start with cucumber.
I am aware of maven n adding the dependency. I am doing it in my
office and due to firewall and other security reasons I am not able to
download maven plugin. That is why I am doing with normal project with
the help of jar files.

I have added all the jars but still getting the error. Not sure about
the error, so seeking for a help.

Thanks,
Gaurav Sharma

Björn Rasmusson

unread,
Mar 30, 2016, 2:02:52 AM3/30/16
to Cukes
Sharma wrote:
Hi,

I am using Eclipse since last 3 years. I have extensively used it for
Selenium. Now I want to start with cucumber.
I am aware of maven n adding the dependency. I am doing it in my
office and due to firewall and other security reasons I am not able to
download maven plugin. That is why I am doing with normal project with
the help of jar files.

I have added all the jars but still getting the error.
Which jar files do you mean with "all the jars"?

/Björn

 

Gaurav Sharma

unread,
Mar 30, 2016, 2:10:38 AM3/30/16
to cu...@googlegroups.com
Below are the jars :

1. cucumber-core-1.1.5
2. cucumber-html-0.2.3
3. cucumber-java-1.1.5
4. cucumber-junit-1.1.5
5. cucumber-jvm-deps-1.0.3
6. hamcrest-all-1.3
7. junit-4.11
8. selenium-server-standalone-2.42.0
9. gherkin-2.12.1

I have even used the latest jars, but error is same.

Error :

Usage: java cucumber.api.cli.Main [options] [ [FILE|DIR][:LINE[:LINE]*] ]+

Options:

-g, --glue PATH Where glue code (step
definitions and hooks) is loaded from.
-f, --format FORMAT[:PATH_OR_URL] How to format results. Goes to
STDOUT unless PATH_OR_URL is specified.
Built-in FORMAT types: junit,
html, pretty, progress, json.
FORMAT can also be a fully
qualified class name.
-t, --tags TAG_EXPRESSION Only run scenarios tagged with
tags matching TAG_EXPRESSION.
-n, --name REGEXP Only run scenarios whose names
match REGEXP.
-d, --[no-]-dry-run Skip execution of glue code.
-m, --[no-]-monochrome Don't colour terminal output.
-s, --[no-]-strict Treat undefined and pending
steps as errors.
--snippets Snippet name: underscore, camelcase
--dotcucumber PATH_OR_URL Where to write out runtime
information. PATH_OR_URL can be a file system
path or a URL.
-v, --version Print version.
-h, --help You're looking at it.

Exception in thread "main" cucumber.runtime.CucumberException: Unknown
option: --plugin
at cucumber.runtime.RuntimeOptions.parse(RuntimeOptions.java:119)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:50)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:44)
at cucumber.api.cli.Main.run(Main.java:20)
at cucumber.api.cli.Main.main(Main.java:16)


Feature File :
Feature: Title of your feature

Scenario: Title of your scenario
Given I naviagted to the zoo website
When I click on adoption link
Then I check to see that no animals are available

I am running it as a "Cucumber Feature".

Paolo Ambrosio

unread,
Mar 30, 2016, 2:18:19 AM3/30/16
to cu...@googlegroups.com
On Wed, Mar 30, 2016 at 7:10 AM, Gaurav Sharma <gaura...@gmail.com> wrote:
> Below are the jars :
>
> 1. cucumber-core-1.1.5
> 2. cucumber-html-0.2.3
> 3. cucumber-java-1.1.5
> 4. cucumber-junit-1.1.5
> 5. cucumber-jvm-deps-1.0.3
> 6. hamcrest-all-1.3
> 7. junit-4.11
> 8. selenium-server-standalone-2.42.0
> 9. gherkin-2.12.1
>
> I have even used the latest jars, but error is same.

Can you give us a jar list of when you are using it with the latest jars?

Mustafa must be a colleague of yours since you are having the same
problem using exactly the same library versions. He never replied to
"you
forgot to upgrade gherkin to 2.12.2 and cucumber-jvm-deps to 1.0.5"
when he upgraded to the latest Cucumber-JVM.
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.

Gaurav Sharma

unread,
Mar 30, 2016, 2:28:28 AM3/30/16
to cu...@googlegroups.com
I was following a video on youtube to start with cucumber, he must be
using the same video. Rest I do not know about him.

latest Jars :

1. cucumber-core-1.2.4
2. cucumber-html-0.2.3
3. cucumber-java-1.1.3
4. cucumber-junit-1.2.4
5. cucumber-jvm-deps-1.0.5
6. gherkin-2.9.3
7. hamcrest-all-1.1
8. junit-4.12
9. selenium-server-standalone-2.53.0

Paolo Ambrosio

unread,
Mar 30, 2016, 3:16:08 AM3/30/16
to cu...@googlegroups.com
On Wed, Mar 30, 2016 at 7:28 AM, Gaurav Sharma <gaura...@gmail.com> wrote:
> I was following a video on youtube to start with cucumber, he must be
> using the same video. Rest I do not know about him.
>
> latest Jars :
>
> 1. cucumber-core-1.2.4
> 2. cucumber-html-0.2.3
> 3. cucumber-java-1.1.3
> 4. cucumber-junit-1.2.4
> 5. cucumber-jvm-deps-1.0.5
> 6. gherkin-2.9.3
> 7. hamcrest-all-1.1
> 8. junit-4.12
> 9. selenium-server-standalone-2.53.0

Good. You should be able to spot discrepancies in the Cucumber jar
versions, as well as with what I quoted in my pervious reply :-)

Gaurav Sharma

unread,
Mar 30, 2016, 6:10:05 AM3/30/16
to cu...@googlegroups.com
I used that version of gherkin also, but same result :)

Paolo Ambrosio

unread,
Mar 30, 2016, 7:31:52 AM3/30/16
to cu...@googlegroups.com
On Wed, Mar 30, 2016 at 11:10 AM, Gaurav Sharma <gaura...@gmail.com> wrote:

> I used that version of gherkin also, but same result :)

...and what version of cucumber-java?

Gaurav Sharma

unread,
Mar 30, 2016, 8:33:46 AM3/30/16
to cu...@googlegroups.com
I have used both old and new versions :

Old :
1. cucumber-core-1.1.5
2. cucumber-html-0.2.3
3. cucumber-java-1.1.5
4. cucumber-junit-1.1.5
5. cucumber-jvm-deps-1.0.3
6. hamcrest-all-1.3
7. junit-4.11
8. selenium-server-standalone-2.42.0
9. gherkin-2.12.1

New :

1. cucumber-core-1.2.4
2. cucumber-html-0.2.3
3. cucumber-java-1.1.3
4. cucumber-junit-1.2.4
5. cucumber-jvm-deps-1.0.5
6. gherkin-2.9.3
7. hamcrest-all-1.1
8. junit-4.12
9. selenium-server-standalone-2.53.0

Roberto Lo Giacco

unread,
Mar 30, 2016, 8:58:10 AM3/30/16
to cu...@googlegroups.com
On Wed, Mar 30, 2016 at 2:33 PM, Gaurav Sharma <gaura...@gmail.com> wrote:
I have used both old and new versions :

Old :
1. cucumber-core-1.1.5
2. cucumber-html-0.2.3
3. cucumber-java-1.1.5
4. cucumber-junit-1.1.5
5. cucumber-jvm-deps-1.0.3
6. hamcrest-all-1.3
7. junit-4.11
8. selenium-server-standalone-2.42.0
9. gherkin-2.12.1

New :

1. cucumber-core-1.2.4
2. cucumber-html-0.2.3
3. cucumber-java-1.1.3
4. cucumber-junit-1.2.4
5. cucumber-jvm-deps-1.0.5
6. gherkin-2.9.3
7. hamcrest-all-1.1
8. junit-4.12
9. selenium-server-standalone-2.53.0


​So, in your opinion, cucumber-java-1.1.3 is newer than cucumber-java 1.1.5? 

It doesn't get much to understand cucumber-core, java, html and junit should all be at version 1.2.4​, I also believe you need cucumber-jvm-deps (1.0.5) and gherkin (2.12.2).

All the necessary and optional dependencies are listed here (https://repo1.maven.org/maven2/info/cukes/cucumber-jvm/1.2.4/cucumber-jvm-1.2.4.pom).

Selenium is a separate thing, I hardly believe you can get through with just the standalone server.

Gaurav Sharma

unread,
Mar 30, 2016, 9:13:25 AM3/30/16
to cu...@googlegroups.com
I was trying to give it a try with different version, that why the
cucumber java version got mixed.

I tried using the version mentioned by you and getting the below 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:80)
at cucumber.runtime.Runtime.<init>(Runtime.java:69)
at cucumber.runtime.Runtime.<init>(Runtime.java:65)
at cucumber.api.cli.Main.run(Main.java:35)
at cucumber.api.cli.Main.main(Main.java:18)

Paolo Ambrosio

unread,
Mar 30, 2016, 9:34:07 AM3/30/16
to cu...@googlegroups.com
On Wed, Mar 30, 2016 at 2:13 PM, Gaurav Sharma <gaura...@gmail.com> wrote:
> I was trying to give it a try with different version, that why the
> cucumber java version got mixed.
>
> I tried using the version mentioned by you and getting the below 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:80)
> at cucumber.runtime.Runtime.<init>(Runtime.java:69)
> at cucumber.runtime.Runtime.<init>(Runtime.java:65)
> at cucumber.api.cli.Main.run(Main.java:35)
> at cucumber.api.cli.Main.main(Main.java:18)

Are you sure cucumber-java is in the classpath? That message means
exactly that you have no backend in the classpath, and cucumber-java
is one of them.

https://www.google.com/#q=cucumber+%22No+Backends+were+found%22

In case you don't have access to a computer outside work, where you
said you can't access maven repositories, this is the list of
dependency from the cucumber-java-skeleton:

$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Cucumber-Java Skeleton 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @
cucumber-java-skeleton ---
[INFO] cucumber:cucumber-java-skeleton:jar:0.0.1
[INFO] +- info.cukes:cucumber-java:jar:1.2.4:test
[INFO] | \- info.cukes:cucumber-core:jar:1.2.4:test
[INFO] | +- info.cukes:cucumber-html:jar:0.2.3:test
[INFO] | +- info.cukes:cucumber-jvm-deps:jar:1.0.5:test
[INFO] | \- info.cukes:gherkin:jar:2.12.2:test
[INFO] +- info.cukes:cucumber-junit:jar:1.2.4:test
[INFO] \- junit:junit:jar:4.12:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.197 s
[INFO] Finished at: 2016-03-30T14:30:45+01:00
[INFO] Final Memory: 13M/309M
[INFO] ------------------------------------------------------------------------

Roberto Lo Giacco

unread,
Mar 30, 2016, 9:36:31 AM3/30/16
to cu...@googlegroups.com

On Wed, Mar 30, 2016 at 3:13 PM, Gaurav Sharma <gaura...@gmail.com> wrote:
cucumber.runtime.CucumberException: No
backends were found. Please make sure you have a backend module on
your CLASSPATH

​cucumber-java​

Gaurav Sharma

unread,
Mar 31, 2016, 2:00:27 AM3/31/16
to cu...@googlegroups.com
I am using cucumber-java 1.1.3, now getting other error message :

Exception in thread "main" cucumber.runtime.CucumberException: Failed
to instantiate public
cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader)
with [cucumber.runtime.io.MultiLoader@1c5cd7]
at cucumber.runtime.Reflections.newInstance(Reflections.java:44)
at cucumber.runtime.Reflections.instantiateSubclasses(Reflections.java:30)
at cucumber.runtime.Runtime.loadBackends(Runtime.java:98)
at cucumber.runtime.Runtime.<init>(Runtime.java:65)
at cucumber.api.cli.Main.run(Main.java:35)
at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at cucumber.runtime.Reflections.newInstance(Reflections.java:41)
... 5 more
Caused by: java.lang.NoSuchMethodError:
cucumber.runtime.io.ClasspathResourceLoader.getAnnotations(Ljava/lang/String;)Ljava/util/Collection;
at cucumber.runtime.java.ClasspathMethodScanner.findCucumberAnnotationClasses(ClasspathMethodScanner.java:75)
at cucumber.runtime.java.ClasspathMethodScanner.<init>(ClasspathMethodScanner.java:23)
at cucumber.runtime.java.JavaBackend.<init>(JavaBackend.java:30)
... 10 more

Roberto Lo Giacco

unread,
Mar 31, 2016, 4:27:18 AM3/31/16
to cu...@googlegroups.com
​Who told you to use version 1.1.3? Both us told you to use 1.2.4 and you are still missing libraries.

This is plain Java programming man!

Gaurav Sharma

unread,
Mar 31, 2016, 5:12:53 AM3/31/16
to cu...@googlegroups.com
I am really sorry, I missed out that.

Thanks a lot for your help.

Nagarjuna Reddy

unread,
Aug 19, 2016, 12:37:39 PM8/19/16
to Cukes
Hi All,

Am getting the same issue. 


cucumber.runtime.CucumberException: Failed to instantiate class com.test1.demo.StepDefinitionXMLValidations
at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:46)
at cucumber.runtime.java.DefaultJavaObjectFactory.getInstance(DefaultJavaObjectFactory.java:32)
at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38)
at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37)
at cucumber.runtime.Runtime.runStep(Runtime.java:299)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at cucumber.runtime.junit.ExamplesRunner.run(ExamplesRunner.java:59)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
...

Below are the my dependencies used in pom.xml:
cucumber-java 1.2.4
cucumber-junit - 1.2.4
cucumber -core -1.2.4

Please suggest 

Roberto Lo Giacco

unread,
Aug 19, 2016, 5:54:44 PM8/19/16
to cu...@googlegroups.com

On Sun, Aug 14, 2016 at 1:32 AM, Nagarjuna Reddy <nagarj...@gmail.com> wrote:

Please suggest 

​May be reading the posting rules first can help?


Paolo Ambrosio

unread,
Aug 20, 2016, 3:34:27 AM8/20/16
to cu...@googlegroups.com
On Sun, Aug 14, 2016 at 12:32 AM, Nagarjuna Reddy
<nagarj...@gmail.com> wrote:
> Hi All,
>
> Am getting the same issue.

Please refrain from resuming an old thread, especially if unrelated.

> cucumber.runtime.CucumberException: Failed to instantiate class
> com.test1.demo.StepDefinitionXMLValidations

*** Failed to instantiate class com.test1.demo.StepDefinitionXMLValidations ***

Have you got a default constructor? Can't help you with just the stack
trace and the versions.
> You received this message because you are subscribed to the Google Groups
> "Cukes" group.
> To unsubscribe from this group and stop receiving emails from it, send an
Reply all
Reply to author
Forward
0 new messages