Skip to content

Latest commit

 

History

History
109 lines (82 loc) · 4.91 KB

install-cucumber-jvm.md

File metadata and controls

109 lines (82 loc) · 4.91 KB
layout title
bootstrap
Install Cucumber-JVM

{{page.title}}

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.

{% highlight xml %} sonatype-snapshots https://oss.sonatype.org/content/repositories/snapshots true {% endhighlight %}

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.

The easiest is to grab the jars you need with Maven or Ant

Programming Language modules

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:

Language/Platform Jar file
Java cucumber-java
Clojure cucumber-clojure
Groovy cucumber-groovy
Ioke cucumber-ioke
JavaScript (Rhino interpreter) cucumber-rhino
Python (Jython interpreter) cucumber-jython
Ruby (JRuby interpreter) cucumber-jruby
Scala cucumber-scala
Android cucumber-android

Dependency Injection modules for cucumber-java

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
PicoContainer cucumber-picocontainer
Guice cucumber-guice
OpenEJB cucumber-openejb
Spring cucumber-spring
Weld cucumber-weld
Needle cucumber-needle

Runners

There are several ways to run Gherkin Features with Cucumber-JVM:

Runner Jar file
Command Line Interface cucumber-core
JUnit Runner cucumber-junit
Android Runner cucumber-android

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 cucumber-junit module.

This should help you pick the 2 or 3 modules you need. Let's install them:

Manual download

You can browse your way to the modules you need in the Sonatype repository. Or you can search for them in Maven Central.

Maven

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:

{% highlight xml %} info.cukes cucumber-picocontainer 1.1.5 test info.cukes cucumber-junit 1.1.5 test junit junit 4.11 test {% endhighlight %}

You don't have to explicitly add a dependency on cucumber-core as all the other packages depend on it.

Ant

You'd better take a look at the java-helloworld build.xml file