Dependencies
Make sure the Cucumber version is the same for all Cucumber dependencies.
Watch the Cucumber School video lesson on installing Cucumber for JVM languages here.
Cucumber-JVM is published in the central Maven repository. You can install it by adding dependencies to your project.
Add the following dependency to your pom.xml
:
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.20.1</version>
<scope>test</scope>
</dependency>
You can now run Cucumber from the command line or run Cucumber with Maven.
If you are using Gradle 4.10.3 or older add the following dependencies to build.gradle
:
dependencies {
testCompile 'io.cucumber:cucumber-java:7.20.1'
testCompile 'io.cucumber:cucumber-junit:7.20.1'
}
repositories {
mavenCentral()
}
Similarly, if you want to use Gradle 5.0 or more recent add the following dependencies to build.gradle
:
dependencies {
testImplementation 'io.cucumber:cucumber-java:7.20.1'
testImplementation 'io.cucumber:cucumber-junit:7.20.1'
}
repositories {
mavenCentral()
}
You can now run Cucumber from the command line to execute by adding a cucumber task to build.gradle
.
It is also possible to use cucumber-junit-platform-engine to run your Cucumber test suite.
It is also possible to use cucumber-junit to run your Cucumber test suite.
Cucumber does not come with an assertion library. Instead, use the assertion methods from a unit testing tool.
While it’s not required, we strongly recommend you include one of the dependency injection modules as well. This allows you to share state between step definitions without resorting to static variables (a common source of flickering scenarios).
You can help us improve this documentation. Edit this page.