Cucumber Tutorial
Cucumber Setup In Eclipse
How To Setup Cucumber In Eclipse ?
Steps To Setup Cucumber In Eclipse 1. Install Java and Set Environment Variable for JDK => Follow Guide 2. Install and Setup Maven => Follow Guide 3. Create a Maven Project => Follow Guide 4. Download 'Cucumber Eclipse Plugin' from 'Eclipse Marketplace' . 5. Add 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>
6. 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.
7. 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.