【问题标题】:Gradle doesn't pick up Cucumber-jvmGradle 不接 Cucumber-jvm
【发布时间】:2012-06-24 00:54:13
【问题描述】:

我正在尝试从 Gradle 运行 Cucumber-jvm。但是,无论我做什么,我都无法让这些功能真正运行。在运行其他 JUnit 测试时,它们总是被跳过。我的功能在src/test/resources 中,我在src/test/java 中有一个JUnit 测试,并指定了@RunWith(Cucumber.class)@Feature(Myfeature.feature) 属性。这是我的 Gradle 脚本:

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'
}

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

【问题讨论】:

  • 看来这个特殊问题与黄瓜 RC13 有关。我更新到 RC15,现在我收到 Cucumber 找不到我的功能的异常。cucumber.runtime.CucumberException: No features found at [Testfeature.feature]

标签: cucumber gradle cucumber-jvm cucumber-junit


【解决方案1】:

我终于得到了这个工作。应该有利于大家了解如何一起使用 Gradle 和 Cucumber-jvm。首先你需要 RC15 才能启动,其他版本有我不太明白的问题。您的 testcompile 部分需要看起来像我上面的内容。

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

将您的 .feature 文件放在 src/test/resources 的根目录中。出于某种原因,Cucumber 不会拾取子文件夹中的文件。

希望能为人们节省大量时间。

【讨论】:

  • 如果要将功能文件放在子目录中,只需更改@Feature 属性以匹配资源文件夹下开始的路径。所以如果是 src/test/resources/com/yourapp/features/featurefile.feature。那么属性将是 @Feature(value="com/yourapp/features/featurefile.feature")
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-12-26
  • 1970-01-01
  • 1970-01-01
  • 2016-12-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多