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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top