very new to Gradle and even newer to Cucumber-jvm so please be patient.
I have created a Java project but have chosen Gradle as my build system.
I have copied over the cucumber-jvm examples (for Java) into my project and added the necessary dependencies to build.gradle.
When I run the cucumber test using my IDE (IntelliJ) it works ok. However, when running ‘gradle test’ on the command line, nothing happens as if it does not recognise the test.
Here’s the test that needs to run (and provides hooks into the cucumber architecture):
import cucumber.junit.Cucumber;
import cucumber.junit.Feature;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@Feature(value = "CarMaintenance.feature")
public class FuelCarTest {
}
Hi patel, I am not familiar with cucumber, but can you provide a small sample project (including build.gradle + sources) that demonstrates this issue and I’ll have a look at it.
actually, I think the problem may be because gradle does not include some resources - they end in .feature. How do I tell Gradle to include them into the build/classes directory?
you have different options. you can: - paste the build.gradle file and a sample test here in the forum if it is a simple/short one - send it as an attachment to the gradle user mailing list (user@gradle.codehaus.org) - create an issue at http://issues.gradle.org and attache it there. - push a sample to github / etc.
as a default, the build classes directory contains compiled classes only. Resources are copied by the processResources task to build/resources/main. These two folders are added to the test classpath when running tests with gradle. Is this .feature file part of your main- or of your test resources? Does the .feature file appear in your build/resources/main (build/resources/test) folder?
Cucumber works by using the RunCukesTest class as a hook into the framework. Its meant to have no methods.
Now when I run tests with Intellij, it seems to work. Intellij merges the class files and resources inot the same directories (keeping prod and test separate).
However, Gradle keeps resources in a separate high-level directory all together. This may be part of the problem but I’m not sure.
In answer to Rene’s question, the feature files are part of the test/resources.