Re: [Cucumber] [JVM] CucumberException: No features found at []

9,059 views
Skip to first unread message

aslak hellesoy

unread,
Jan 21, 2013, 7:10:21 AM1/21/13
to Cucumber Users



On Mon, Jan 21, 2013 at 11:42 AM, Sarthak Dayanand <sarth...@gmail.com> wrote:

In my cucumber -jvm, Maven, junit Setup I have my testRunner file as

What cucumber-jvm version? 

package com.lebara.testrunner;

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

@RunWith(Cucumber.class) @Cucumber.Options(

glue = {"com.lebara.stepdefs","com.lebara.framework.main", "com.lebara.testrunner"}, features = "C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources", format = {"pretty", "html:target/cucumber-html-report", "json-pretty:target/cucumber-report.json"}, tags = {"@UserJourney"}

) public class RunCukesTest { }

I have my feature file in the above mentioned directory.

If I run it, I get the exception,

cucumber.runtime.CucumberException: No features found at [C:/Users/sarthak.dayanand/Documents/WebRefreshTest/CukeAutomation/LebaraWebAutomationTest1/src/main/resources/cucumber]...

Hav you double checked that you have feature files in this directory? Try using backslash as file separator instead (double-backslash in java). That way you can do a dir c:\path\to\dir to verify that you don't have a typo in your path. 

In any case, I recommend not using an absolute file path. The features will only run on your machine and nobody else's.

If I remove the "features" option in the testrunner, it tries to look for feature files in the same directory as my testrunner.java

Not exactly. It tries to look at the *path* com/lebara/testrunner within your *classpath*. The path corresponds to the package of your test class.
Essentially it defaults to features = "classpath:com/lebara/testrunner"

cucumber.runtime.CucumberException: No features found at [com/lebara/testrunner]

And if I put the feature files there, it works.

My question is why is my feature file not being picked up from my previous location, which i thought to be the default file structure for cucumber - maven setup.


Maven usually puts anything under src/main/resources on your classpath. In other words, "cucumber" becomes a directory on your classpath.
Try leaving the files here, and specify this:

features = "classpath:cucumber" 

HTH,
Aslak

How do I make it pick up from there? Help appreciated.

--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
 
 

Sarthak Dayanand

unread,
Jan 21, 2013, 7:46:54 AM1/21/13
to cu...@googlegroups.com
Thanks for the quick response Aslak. 

1. What cucumber-jvm version? 
<version>1.0.2</version>

2. Hav you double checked that you have feature files in this directory?
Yes. I can see the files in the path. 

Also tried double backslash as in features = "C:\\Users\\sarthak.dayanand\\Documents\\WebRefreshTest\\CukeAutomation\\LebaraWebAutomationTest1\\src\\main\\resources",
//features = "classpath:cucumber", 

Tried the relative path first. features = "LebaraWebAutomationTest1/src/test/resources/cucumber/dashBoardUserJourney/DashboardPageUserJourney.feature",
Since it did not work had to resolve to absolute path.

3. tried this as well features = "classpath:cucumber". 

Same error. 

BTW, thanks for the explanation about how maven paths and directory structure. 

aslak hellesoy

unread,
Jan 21, 2013, 7:56:16 AM1/21/13
to Cucumber Users
On Mon, Jan 21, 2013 at 12:46 PM, Sarthak Dayanand <sarth...@gmail.com> wrote:
Thanks for the quick response Aslak. 

1. What cucumber-jvm version? 
<version>1.0.2</version>

There has been many, many releases and bug fixes since that:

Please try 1.1.1. I highly recommend reading through the changelog.

Aslak

Sarthak Dayanand

unread,
Jan 21, 2013, 8:12:01 AM1/21/13
to cu...@googlegroups.com
Thanks. I shall read through the changelog. 

Have updated cucumber-java to 1.1.1

Now get a different exception.

java.lang.NoClassDefFoundError: cucumber/io/ResourceLoader
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:32)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:41)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:31)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: cucumber.io.ResourceLoader
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 18 more

aslak hellesoy

unread,
Jan 21, 2013, 8:39:36 AM1/21/13
to Cucumber Users
On Mon, Jan 21, 2013 at 1:12 PM, Sarthak Dayanand <sarth...@gmail.com> wrote:
Thanks. I shall read through the changelog. 

Have updated cucumber-java to 1.1.1

Now get a different exception.

java.lang.NoClassDefFoundError: cucumber/io/ResourceLoader

Nothing in Cucumber-JVM 1.1.1 refers to a class named cucumber.io.ResourceLoader anymore, so you must have some old cucumber-jvm classes on your classpath as well. Get rid of the old jars.

Sarthak Dayanand

unread,
Jan 21, 2013, 9:15:41 AM1/21/13
to cu...@googlegroups.com
I dont see any old versions of cucumber-jvm. However just want to know what version of cucumber-junit to be used. 

If I use cucumber-junit version 1.1.1 the Cucumber.class fails to resolve in 

@RunWith(Cucumber.class)
@Cucumber.Options(

Class<Cucumber> cannot be resolved to a type

Sarthak Dayanand

unread,
Jan 21, 2013, 9:50:50 AM1/21/13
to cu...@googlegroups.com
I could Iron out the errors. The packages have changed a bit on 1.1.1 version. I could run it successfully. 

Just a few obervations. If I give the features option as 

features = "LebaraWebAutomationTest1/src/test/resources/cucumber/dashBoardUserJourney/DashboardPageUserJourney.feature

Get an exception saying 
java.lang.IllegalArgumentException: Not a file or directory: C:\Users\sarthak.dayanand\Documents\WebRefreshTest\CukeAutomation

Not sure where it is picking that path from. 

If I give the absolute path, it works fine: 

features = "C:\\Users\\sarthak.dayanand\\Documents\\WebRefreshTest\\CukeAutomation\\LebaraWebAutomationTest1\\src\\main\\resources"

Also it works fine if I give 

features = "classpath:cucumber",

Thanks. 

In this version when 

aslak hellesoy

unread,
Jan 21, 2013, 10:11:17 AM1/21/13
to Cucumber Users
On Mon, Jan 21, 2013 at 2:50 PM, Sarthak Dayanand <sarth...@gmail.com> wrote:
I could Iron out the errors. The packages have changed a bit on 1.1.1 version. I could run it successfully. 

Just a few obervations. If I give the features option as 

features = "LebaraWebAutomationTest1/src/test/resources/cucumber/dashBoardUserJourney/DashboardPageUserJourney.feature

Get an exception saying 
java.lang.IllegalArgumentException: Not a file or directory: C:\Users\sarthak.dayanand\Documents\WebRefreshTest\CukeAutomation

Not sure where it is picking that path from. 


Hard to tell without access to your source code or file system. 

If I give the absolute path, it works fine: 

features = "C:\\Users\\sarthak.dayanand\\Documents\\WebRefreshTest\\CukeAutomation\\LebaraWebAutomationTest1\\src\\main\\resources"

Also it works fine if I give 

features = "classpath:cucumber",


I recommend the classpath: approach. It's simple and will work across machines.

Aslak
Reply all
Reply to author
Forward
0 new messages