Gradle没有拿起Cucumber-jvm [英] Gradle doesn't pick up Cucumber-jvm

查看:223
本文介绍了Gradle没有拿起Cucumber-jvm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Gradle运行Cucumber-jvm。但是,无论我做什么,我都无法获得实际运行的功能。当其他JUnit测试运行时,它们总是被跳过。我的功能在 src / test / resources 中,并且在 src / test / java 中有一个JUnit测试,其中<$指定了c $ c> @RunWith(Cucumber.class)和 @Feature(Myfeature.feature)属性。这是我的Gradle脚本:

 存储库{
mavenCentral()
}

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

如果有人知道如何解决这个问题,我们将不胜感激。 Cucumber-jvm文档是不存在的。

解决方案

我终于得到了这个工作。应该对每个人都好,了解如何一起使用Gradle和Cucumber-jvm。首先你需要RC15开始,其他版本有我不太明白的问题。您的测试编译部分需要看起来像我上面所描述的。



接下来在 src / test / java / path / of / package中创建一个测试/ 。测试需要使用JUnit @RunWith 和Cucumber-Jvm的 @Feature(value =featurefile.feature )属性。

将.feature文件放在 src / test / resources 的根目录下。由于某些原因,Cucumber不会在子文件夹中找到文件。



希望可以节省大量时间。


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.

解决方案

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.

这篇关于Gradle没有拿起Cucumber-jvm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆