3

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.

Sled
  • 18,541
  • 27
  • 119
  • 168
Gp De Ciantis
  • 103
  • 1
  • 8
  • So it appears that this particular issue was with cucumber RC13. I updated to RC15 and now I get an exception that Cucumber cannot find my features.`cucumber.runtime.CucumberException: No features found at [Testfeature.feature]` – Gp De Ciantis Feb 17 '12 at 17:14

1 Answers1

3

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.

Sled
  • 18,541
  • 27
  • 119
  • 168
Gp De Ciantis
  • 103
  • 1
  • 8
  • 3
    If you want to put the feature file in a subdirectory, just change the @Feature attribute to match the path starting below the resources folder. So if it is src/test/resources/com/yourapp/features/featurefile.feature. Then the attribute would be @Feature(value="com/yourapp/features/featurefile.feature") – Gp De Ciantis Feb 21 '12 at 04:31