top of page

Cucumber Setup In Eclipse

Steps To Setup Cucumber In Eclipse

1. Install Java.

2Set Environment Variable for JDK .

3Install Maven.

4Unzip the file at some Location.

5Set Environment Variable for Maven.

6Create a Maven Project .

7Download 'Cucumber Eclipse Plugin' from 'Eclipse Marketplace' .

8Add essential dependencies for cucumber in pom.xml:

  • cucumber-java

<dependency>
           <groupId>io.cucumber</groupId>
           <artifactId>cucumber-java</artifactId>
           <version>6.10.2</version>
       </dependency>

  • cucumber-junit

<dependency>
           <groupId>io.cucumber</groupId>
           <artifactId>cucumber-junit</artifactId>
           <version>6.10.2</version>
       </dependency>

* If you want to use it with selenium then add selenium dependency :

  • selenium-java

<dependency>
           <groupId>org.seleniumhq.selenium</groupId>
           <artifactId>selenium-java</artifactId>
           <version>4.0.0</version>
       </dependency>

 

9. Create a feature file under the project :

Right-click on the project and navigate inside New.

Click on option Folder and name it as 'Features.

Under this Features folder, create a new .feature file as 'feature.feature' .

Write test scenarios here.

10. Create step-definition file :

Create a package under src/main/java named as 'stepdefinitions' :

Right-click on this package and navigate through New.

Under New, click on Other.. and select Step-Definition class under the option Cucumber.

Proeced to Next,enter class name,check the annotations as per requirement and move to Finish .

Step-Definition class has been created now.

Write test scripts here.

Refer next page First Selenium Test And Mapping In Cucumber

bottom of page