DevLabs Alliance - WhatsApp
DevLabs Alliance Logo

Home / Interview /Installing Cucumber...

Installing Cucumber - Tutorial - Setup Guide

Srinivasan G

2024-01-04

DevLabs Alliance Interview

0 mins read

DevLabs Alliance Interview

Download Cucumber JVM for Eclipse

The functionality of the cucumber is abstracted out in jars and to execute a Cucumber test

using Java in Eclipse, you need various Cucumber jars or modules.


There are various ways to download Cucumber jars for Eclipse; choose one from the alternatives

listed below:


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


We will talk about Downloading Cucumber Jars from Maven dependencies

Download Cucumber Jars from Maven dependencies

Download Cucumber Jars from Maven dependencies


The most popular and efficient method of configuring cucumber with eclipse is downloading Cucumber Jars from Maven dependencies. But those who are unfamiliar with Maven may find this to be somewhat challenging and end up losing a lot of time. Few conditions must be met in order to configure cucumber in eclipse.


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


Navigation flow: File->New->Others->Maven project.


The user needs to type the name of the Project folder in a new window that appears. Below is a screenshot for the same.



Click on Maven Project > Next



Select the Checkbox to create a simple project > Next



User need to give Group id Name And  Artifact id Name > Finish



Observe the package Explorer > POM.xml



By default, pom.xml will be generated like this:


<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

       <modelVersion>4.0.0</modelVersion>

       <groupId>DLA_CucumberJava</groupId>

       <artifactId>DLA_CucumberJava</artifactId>

       <version>0.0.1-SNAPSHOT</version>

</project>

Add Dependencies for Cucumber Java|Cucumber JUnit | JUn

The next step is to add cucumber dependencies to the project once Maven has been installed on Eclipse and a Maven project has been created.


Add the below dependency to pom.xml


<dependencies>
 
    <!--
    https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->

    <dependency>

        <groupId>io.cucumber</groupId>

        <artifactId>cucumber-java</artifactId>

        <version>7.8.1</version>

    </dependency>

</dependencies>



Below dependencies will get added after successful build.



Create Folder Structure

Let's make a good folder structure for the project before moving on to write the first script.


Create a new Package by right-click on the src/test/resources folder and select New > Package.



A new pop-up window will open. Specify the name as DLA_Feature and click on Finish.



Now the folder structure will look like:



Create a new file under DLA_Feature folder:



A pop-up window will open.

Provide the file name as DLA_Login.feature and click on Finish.