Gradle doesn't pick up Cucumber-jvm

倾然丶 夕夏残阳落幕 提交于 2019-12-10 18:12:32

问题


I am trying to run Cucumber-jvm from Gradle. However no matter what I do I cannot get the features to actually run. They are always skipped while other JUnit tests are run. My features are in src/test/resources and I have a JUnit test in src/test/java with @RunWith(Cucumber.class) and @Feature(Myfeature.feature) attributes specified. Here is my Gradle script:

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.+'
    testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.0.0.RC13'
    testCompile group: 'info.cukes', name: 'cucumber-java', version: '1.0.0.RC13'
    testCompile group: 'info.cukes', name: 'cucumber-picocontainer', version: '1.0.0.RC13'
    testCompile group: 'info.cukes', name: 'cucumber-core', version: '1.0.0.RC13'
    testCompile group: 'org.picocontainer', name: 'picocontainer', version: '2.10.2'
}

If someone has an idea of what to do to fix this it would be appreciated. Cucumber-jvm documentation is non-existent.


回答1:


I finally got this working. Should be good for everyone to understand how to use Gradle and Cucumber-jvm together. First you need RC15 to start, other builds have issues that I don't quite understand. Your testcompile section needs to look like what I have above.

Next create a test in the src/test/java/path/of/package/. I haven't tested with other languages.The test needs use the JUnit @RunWith and Cucumber-Jvm's @Feature(value="featurefile.feature") attributes.

Put your .feature file in the root of src/test/resources. For some reason Cucumber doesn't pick up files in child folders.

Hope that saves people a lot of time.



来源:https://stackoverflow.com/questions/9330508/gradle-doesnt-pick-up-cucumber-jvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!