Cucumber-JVM consists of several modules (jars) that you can download from the public maven repo.
If you like living dangerously you can also get SNAPSHOT builds from the sonatype snapshot repo.
<repository> <id>sonatype-snapshots</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> <snapshots> <enabled>true</enabled> </snapshots> </repository>
You will always need the
cucumber-core module, which contains the main logic for parsing and executing your Gherkin feature files.
If you’re wondering what the latest Cucumber-JVM release is, check out the tags on Github.
In addition to
cucumber-core you will also need a programming language-specific module, depending on what programming language you are using. The available programming language modules are:
|Python (Jython interpreter)||
|Ruby (JRuby interpreter)||
If your programming language is Java you will be writing glue code (Step Definitions and Hooks) in plain old Java classes. Cucumber will create a new instance of each of your glue code classes before each Scenario. If all of your glue code classes have an empty constructor you don’t need anything else. However, most projects will benefit from a Dependency Injection module to organize your code better.
The available Dependency Injection modules are:
|Dependency Injection Container||Jar file|
There are several ways to run Gherkin Features with Cucumber-JVM:
|Command Line Interface||
The JUnit Runner lets you run Cucumber from any tool that understands JUnit. This includes IDEs (such ash IntelliJ or Eclipse) and build tools (such as Ant, Maven or Gradle).
Any build tool can execute command line programs (Cucumber’s Command Line Interface), so if you prefer this way to run your features you don’t need the
This should help you pick the 2 or 3 modules you need. Let’s install them:
Installing the various
cucumber-* modules in a Maven project is just a matter of adding them to your
pom.xml file. Here is the minimal recommended setup:
<dependencies> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-picocontainer</artifactId> <version>1.1.5</version> <scope>test</scope> </dependency> <dependency> <groupId>info.cukes</groupId> <artifactId>cucumber-junit</artifactId> <version>1.1.5</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> </dependencies>
You don’t have to explicitly add a dependency on
cucumber-core as all the other packages depend on it.
Take a look at the cucumber-java-skeleton build.xml file.