Cucumber functionality is abstracted out in jars and following Cucumber jars/modules are required to run a Cucumber test with Java in Eclipse.

  1. cucumber-core
  2. cucumber-java
  3. cucumber-junit
  4. cucumber-jvm-deps
  5. cucumber-reporting
  6. gherkin
  7. junit
  8. mockito-all
  9. cobertura

There are many options to download Cucumber jars for Eclipse, can follow any of these below:

  • Download Cucumber Jars from Online Maven Repository
  • Download Cucumber Jars from oss.sonatype.org
  • Download Cucumber Jars from Maven dependencies (Easiest)

Option 1 : Download Cucumber Jars from Online Maven Repository

  1. Go to https://search.maven.org.

Download Cucumber JVM for Eclipse

  1. Search for cucumber-core in the Central Maven Repository. It will return the Cucumber Core jars. Click on the jar.

Cucumber_2

  1. It will display a pop up and ask you to save the cucumber core jar file.

Cucumber_3

  1. Just like this, one by one search for every other jar file mentioned above and downloads these to your drive.

Cucumber_7

Note that core, java and junit files all need to be the same file version e.g. 1.2.0

Also, one most important thing to know is to download the correct Jars. As when you search for these libraries, you will get many options to download. So below chart will help you to install the right libraries from GroupID.

Cucumber Libraries

I got below versions on Oct’17 for Cucumber

  • cobertura-2.1.1
  • cucumber-core-1.2.5
  • cucumber-java-1.2.5
  • cucumber-junit-1.2.5
  • cucumber-jvm-deps-1.0.5
  • cucumber-reporting-3.10.0
  • gherkin-2.12.2
  • junit-4.12
  • mockito-all-2.0.2-beta

Option 2 : Download Cucumber Jars from oss.sonatype.org

  1. Go to https://oss.sonatype.org/content/repositories/releases/info/cukes/ . Here also all the cucumber jars are available. Start with cucumber-core.

Cucumber_4

  1. Click on the latest version at the bottom of the page, which is version 1.2.0 as of now by Dec'14.

Cucumber_5

  1. Once clicked on the version, it will display the all types of jar available to download. Click on cucumber-core-1.2.0.jar .

Cucumber_6

  1. Just like this, downloads all of these to your drive and every other jar is available on the same page.

Cucumber_7

Note that core, java and junit files all need to be the same file version e.g. 1.2.0

Option 3 : Download Cucumber Jars from Maven dependencies

This is the most common and effective way of setting up cucumber with eclipse. But this is bit tricky for the people who do not have much experience with Maven and may end up in wasting a lot of time. There are few prerequisites for setting up cucumber in eclipse.

  1. Install Maven in Eclipse IDE
  2. Create a New Maven Project in Eclipse

Once Maven is installed on eclipse and a Maven project is created, the next step is to add cucumber dependencies on the project. I have written a nice tutorial on Maven and how to add dependencies in to Maven project. Please follow the Step 4 : Add Dependencies to the Maven Repository at this article. The way we have added Selenium dependencies in the article the same way add the below mentioned dependencies in to the Maven POM.

Do not forget to add all the dependencies for all the below mentioned jars required for Cucumber set up:

  1. cucumber-core
  2. cucumber-java
  3. cucumber-junit
  4. cucumber-jvm-deps
  5. cucumber-reporting
  6. gherkin
  7. junit
  8. mockito-all
  9. cobertura

For example, Open the pom.xml file and Copy the following inside the dependencies tag.

<dependency>
			<groupId>info.cukes</groupId>
			<artifactId>cucumber-java</artifactId>
			<version>1.1.5</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>info.cukes</groupId>
			<artifactId>cucumber-jvm</artifactId>
			<version>1.1.5</version>
			<type>pom</type>
		</dependency>

		<dependency>
			<groupId>info.cukes</groupId>
			<artifactId>cucumber-junit</artifactId>
			<version>1.1.5</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>net.sourceforge.cobertura</groupId>
			<artifactId>cobertura</artifactId>
			<version>2.1.1</version>
		</dependency>
		<dependency>
			<groupId>info.cukes</groupId>
			<artifactId>cucumber-jvm-deps</artifactId>
			<version>1.0.5</version>
		</dependency>
		<dependency>
			<groupId>net.masterthought</groupId>
			<artifactId>cucumber-reporting</artifactId>
			<version>1.0.0</version>
		</dependency>
		<dependency>
			<groupId>info.cukes</groupId>
			<artifactId>gherkin</artifactId>
			<version>2.12.2</version>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-all</artifactId>
			<version>2.0.2-beta</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
Install Cucumber Eclipse Plugin
Install Cucumber Eclipse Plugin
Previous Article
Configure Eclipse with Cucumber
Configure Eclipse with Cucumber
Next Article
Lakshay Sharma
I’M LAKSHAY SHARMA AND I’M A FULL-STACK TEST AUTOMATION ENGINEER. Have passed 16 years playing with automation in mammoth projects like O2 (UK), Sprint (US), TD Bank (CA), Canadian Tire (CA), NHS (UK) & ASOS(UK). Currently, I am working with RABO Bank as a Chapter Lead QA. I am passionate about designing Automation Frameworks that follow OOPS concepts and Design patterns.
Reviewers
Virender Singh's Photo
Virender Singh

Similar Articles

Feedback