我已经看过类似的帖子,并按照那里的建议,仍然无法使用命令执行任何黄瓜测试:gradle test。它总是返回相同的错误,说无法找到.feature文件。
类似帖子: 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
这是我的gradle构建脚本:
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"
}
现在,我的文件夹结构如下:
src/test/
java/
com/mypackage/
Sample.java
resources
com/mypackage/
test.feature
我的Sample.java类看起来像这样:
package test.java.com.mypackage;
import cucumber.api.junit.*;
import org.junit.runner.*;
@RunWith(Cucumber.class)
public class Sample_cucumber_test {
}
答案 0 :(得分:0)
你可以在你的依赖关系部分摆脱配置和依赖符号之间的':',然后再试一次吗?我的意思是代替
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"
}