0
我已經看過類似的帖子,並按照其中的建議,仍然無法使用命令執行任何黃瓜測試:gradle測試。它始終返回相同的錯誤,說找不到.feature文件。gradle cucumber jvm例外:在[classpath:]找不到任何功能
類似的帖子: 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 {
}
在我保持具有ext.libraries = { cucumber_core一個dependencies.gradle文件的項目:「info.cukes:黃瓜核心: 1.1.5「, cucumber_picocontainer:」info.cukes:cucumber-picocontainer:1.1.5「, ....還有更多.. } 所以問題不在於gradle語法,而是因爲黃瓜測試沒有能夠找到.feature文件。 – amitbansalite
我無法複製它,你可以創建一個小的可重複使用的例子,並使它在某處可用(例如github/bitbucket)?非常感謝你。 –