Cucumber is available for most programming languages. The official implementations which are maintained are as follows:
Cucumber – JVM (For Java)
Cucumber.js (For Node.js and browsers)
Cucumber.rb (For Ruby and Ruby on Rails)
Cucumber.cpp (For C++)
Android (For Java)
Kotlin (Cucumber JVM with Kotlin)
Behave (For Python)

Here, we will be installing and using Cucumber-JVM, since we will be using Java.

Cucumber-JVM is published in the Central Maven Repository. You can start working on Cucumber-JVM by either adding the following Maven or Gradle dependencies to your project or by directly downloading the jar files and adding them in your project configuration path.

Maven Dependency
Add the following Maven dependencies in your pom.xml file.







Gradle Dependency
Add the following Gradle dependencies in your build.gradle file.

dependencies {
    testCompile 'io.cucumber:cucumber-java:4.7.1'
    testCompile 'io.cucumber:cucumber-junit:4.7.1'
    providedCompile group: 'info.cukes', name: 'cucumber-jvm-deps', version: '1.0.5'
    compile group: 'io.cucumber', name: 'cucumber-html', version: '0.2.7'
    compile group: 'net.masterthought', name: 'cucumber-reporting', version: '4.8.0'
    testCompile group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3'
    testCompile group: 'org.mockito', name: 'mockito-all', version: '2.0.2-beta'

repositories {

Download as JARs
If you want to use the JAR files, download the following JARs from the Maven Repository and add them directly to your project configuration path:

  • cucumber-core-4.2.6.jar
  • cucumber-java-4.2.6.jar
  • cucumber-junit-4.2.6.jar
    (Remember, the above three jars should have the same version)
  • cucumber-jvm-deps-1.0.5.jar
  • cucumber-html-0.2.7.jar
  • cucumber-reporting-4.7.0.jar
  • gherkin-5.1.0.jar
  • hamcrest-core-1.3.jar
  • mockito-all-2.0.2-beta

Cucumber is a JUnit extension. It is launched by running JUnit from your build tool (e.g. Maven, Gradle) or from your IDE (e.g. Eclipse, Netbeans, IntelliJ etc.)

If you are using Eclipse, you would also like to install the Cucumber-Eclipse-Plugin. To install it, follow the below steps:

Open Eclipse IDE
Go to Help -> Eclipse Marketplace
Enter Cucumber in the Find search box and click on Search
Click on “Install” button for Cucumber Eclipse Plugin

Follow the steps and Cucumber-Eclipse-Plugin will get installed in your Eclipse. Restart Eclipse to view the changes.

Cucumber Installation from Command Line (for Maven Project)

Create a new Maven project by opening the command prompt and going to the directory where you want to create the project. Then run the following command:

mvn archetype:generate                      

Your Maven project will get created. Then open Eclipse and import this Maven project (File -> Import -> Maven -> Existing Maven Projects -> Next -> Browse to the project path -> Finish)
A file will automatically get created inside the path “/HelloCucumber/src/test/java/helloCucumber/”. Add the below code in the file:

package helloCucumber;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@CucumberOptions(plugin = "pretty", features = "src/test/resources/hellocucumber")
public class RunCucumberTest {

To verify that the Cucumber installation is successful for the Maven project, run the below command from the command prompt (you should be inside the directory of the project “HelloCucumber”)

mvn test

You should be able to see “BUILD SUCCESS”. This means that Cucumber is successfully installed and you are ready to run your first scenario using Cucumber.