0
votes

I have already looked at the similar posts and followed the suggestions in there, still not able to execute any cucumber test using command: gradle test. It always returns the same error saying cannot find .feature files.

Similar posts: 1) cucumber jvm CucumberException: No features found at [] 2) Gradle doesn't pick up Cucumber-jvm 3) How do I set the path to my Cucumber features using cucumber-junit? 4) Specify the feature file location in cucumber

Here is my gradle build script:

sourceSets {
        main {          
            java.srcDir 'src/jjrom'
        }
        test {
            java.srcDir 'src/test/java'
            resources.srcDir 'src/test/resources'      
        }
    }

dependencies {
 testCompile : "junit:junit:4.11"
 testCompile : "info.cukes:cucumber-core:1.1.5"
 testCompile : "info.cukes:cucumber-picocontainer:1.1.5"
 testCompile : "info.cukes:cucumber-junit:1.1.5"
 testCompile : "info.cukes:cucumber-java:1.1.5"
 testCompile : "org.picocontainer:picocontainer:2.14.3"

 testCompile : "info.cukes:gherkin:2.9.3"
 testCompile : "info.cukes:cucumber-jvm-deps:1.0.3"
 testCompile : "info.cukes:cucumber-spring:1.1.5"
 testCompile : "org.hamcrest:hamcrest-core:1.3"
}

Now, my folder structure is as follows:

src/test/
    java/
        com/mypackage/
            Sample.java
    resources
        com/mypackage/
            test.feature

My Sample.java class looks like this:

package test.java.com.mypackage;

import cucumber.api.junit.*;
import org.junit.runner.*;

@RunWith(Cucumber.class)
public class Sample_cucumber_test {

}
1

1 Answers

0
votes

can you get rid of the ':' between configuration an dependency notation in your dependency section and try again? I mean instead of

dependencies {
 testCompile : "junit:junit:4.11"
 testCompile : "info.cukes:cucumber-core:1.1.5"
 testCompile : "info.cukes:cucumber-picocontainer:1.1.5"
 testCompile : "info.cukes:cucumber-junit:1.1.5"
 testCompile : "info.cukes:cucumber-java:1.1.5"
 testCompile : "org.picocontainer:picocontainer:2.14.3"

 testCompile : "info.cukes:gherkin:2.9.3"
 testCompile : "info.cukes:cucumber-jvm-deps:1.0.3"
 testCompile : "info.cukes:cucumber-spring:1.1.5"
 testCompile : "org.hamcrest:hamcrest-core:1.3"
}

do

dependencies {
 testCompile "junit:junit:4.11"
 testCompile "info.cukes:cucumber-core:1.1.5"
 testCompile "info.cukes:cucumber-picocontainer:1.1.5"
 testCompile "info.cukes:cucumber-junit:1.1.5"
 testCompile "info.cukes:cucumber-java:1.1.5"
 testCompile "org.picocontainer:picocontainer:2.14.3"

 testCompile "info.cukes:gherkin:2.9.3"
 testCompile "info.cukes:cucumber-jvm-deps:1.0.3"
 testCompile "info.cukes:cucumber-spring:1.1.5"
 testCompile "org.hamcrest:hamcrest-core:1.3"
}