RelationDigest

Thursday, 23 November 2023

[New post] Cucumber Tutorial – How to setup Cucumber with Eclipse

Site logo image vibssingh posted: " HOME In the previous tutorials, we discussed BDD (Behaviour Driven Development) and Gherkin. Cucumber is one such open-source tool, which supports Behaviour Driven Development (BDD). In simple words, Cucumber can be defin" QA Automation Expert

Cucumber Tutorial – How to setup Cucumber with Eclipse

vibssingh

Nov 23

HOME

In the previous tutorials, we discussed BDD (Behaviour Driven Development) and Gherkin. Cucumber is one such open-source tool, which supports Behaviour Driven Development (BDD). In simple words, Cucumber can be defined as a testing framework, driven by plain English. It serves as documentation, automated tests, and development aid – all in one.

In this tutorial, we will set up Cucumber with Eclipse. 

Table of Content

  1. Implementation Steps
    1. Download and Install Java
    2. Download and Start Eclipse
    3. Maven –  How to install Maven on Windows
    4. Install Cucumber Eclipse Plugin
    5. Configure Cucumber with Maven
      1. Create a new Maven Project
      2. Open pom.xml of the project
      3. Add dependency for selenium
      4. Add dependency for Cucumber-Java
      5. Add dependency for Cucumber-JUnit
      6. Add dependency for JUnit

Implementation Steps

1. Download and Install Java

Java is a robust programming language. Java is a general-purpose programming language that is concurrent; class-based and object-oriented language. Java follows the concept of "write once and run anywhere (WORA)" which means that compiled Java code can be run on all different platforms that support Java without the need for recompilation. Cucumber supports the Java platform for execution. Click here to know How to install Java.

2. Download and Start Eclipse

Eclipse is an Integrated Development Environment (IDE). It contains a base workspace and an extensible plug-in system for customizing the environment. To download Eclipse, please refer to this tutorial - How to install Eclipse.

3. Maven –  How to install Maven on Windows 

Apache Maven is a software project management and comprehension tool. It uses the concept of a project object model (POM), Maven can manage a project's build, reporting, and documentation from a central piece of information. MAVEN helps us in creating the project structure and managing and downloading the dependencies. We need to define the required dependencies in pom.xml. To install Maven on Windows, please refer to this tutorial - How to install Maven.

4. Install Cucumber Eclipse Plugin

The Cucumber plugin is an Eclipse plugin that allows eclipse to understand the Gherkin syntax. Cucumber Eclipse Plugin highlights the keywords present in Feature File. To install Cucumber Eclipse Plugin, please refer to this tutorial - How to install Cucumber Eclipse Plugin

5. Configure Cucumber with Maven

Step 1 – Create a new Maven Project.

Click here to know the steps to create a new Maven project -  How to create a Maven project.

Step 2 – Open pom.xml of the project
       

 1. Go to package explorer on the left-hand side of Eclipse.
         2. Expand the project CucumberTest.
         3. Locate pom.xml file
         4. Add dependencies to POM.XML

Step 3 − Add dependency for selenium

This will indicate to Maven that Selenium jar files are to download from the central repository to the local repository.                                                                             

Open pom.xml in the edit mode, create dependencies tag (), inside the project tag.                   

  <!-- Selenium -->  <dependency>       <groupId>org.seleniumhq.selenium</groupId>       <artifactId>selenium-java</artifactId>       <version>4.15.0</version>  </dependency> 
Step 4 -  Add dependency for Cucumber-Java

This will indicate Maven, which Cucumber files are to be downloaded from the central repository to the local repository.  Create one more dependency tag.

 <dependency>     <groupId>io.cucumber</groupId>     <artifactId>cucumber-java</artifactId>     <version>7.14.0</version> </dependency> 
Step 5 - Add dependency for Cucumber-JUnit

This will indicate Maven, which Cucumber JUnit files are to download from the central repository to the local repository. Create one more dependency tag. 

 <dependency>     <groupId>io.cucumber</groupId>     <artifactId>cucumber-junit</artifactId>     <version>7.14.0</version>     <scope>test</scope> </dependency> 
Step 6 -  Add dependency for JUnit

This will indicate Maven, which JUnit files are to be downloaded from the central repository to the local repository. Create one more dependency tag.

 <dependency>    <groupId>junit</groupId>    <artifactId>junit</artifactId>    <version>4.13.2</version>    <scope>test</scope> </dependency> 

Below is the screenshot which shows that Maven Project called Cucumber_JUnit4_Demo.

After adding the above mention dependencies, pom.xml looks like the image below

 <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 http://maven.apache.org/xsd/maven-4.0.0.xsd">   <modelVersion>4.0.0</modelVersion>    <groupId>org.example</groupId>   <artifactId>Cucumber_JUnit4_Demo</artifactId>   <version>1.0-SNAPSHOT</version>   <packaging>jar</packaging>    <name>Cucumber_JUnit4_Demo</name>   <url>http://maven.apache.org</url>    <properties>     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>     <cucumber.version>7.14.0</cucumber.version>     <selenium.version>4.15.0</selenium.version>     <junit.version>4.13.2</junit.version>   </properties>    <dependencies>      <dependency>       <groupId>io.cucumber</groupId>       <artifactId>cucumber-java</artifactId>       <version>${cucumber.version}</version>     </dependency>      <dependency>       <groupId>io.cucumber</groupId>       <artifactId>cucumber-junit</artifactId>       <version>${cucumber.version}</version>       <scope>test</scope>     </dependency>      <!-- Selenium -->     <dependency>       <groupId>org.seleniumhq.selenium</groupId>       <artifactId>selenium-java</artifactId>       <version>${selenium.version}</version>     </dependency>      <!-- JUnit4 -->     <dependency>       <groupId>junit</groupId>       <artifactId>junit</artifactId>       <version>${junit.version}</version>       <scope>test</scope>     </dependency>   </dependencies>  </project> 

After adding the dependencies and then building the project, the below image shows the entire jar files added to the Maven Dependency.

Congratulations!! We are done with the setup of the Cucumber in Eclipse. Happy Learning.

Comment
Like
Tip icon image You can also reply to this email to leave a comment.

Manage your email settings or unsubscribe.

Trouble clicking? Copy and paste this URL into your browser:
http://qaautomation.expert/2023/11/23/cucumber-tutorial-how-to-setup-cucumber-with-eclipse/

WordPress.com and Jetpack Logos

Get the Jetpack app to use Reader anywhere, anytime

Follow your favorite sites, save posts to read later, and get real-time notifications for likes and comments.

Download Jetpack on Google Play Download Jetpack from the App Store
WordPress.com on Twitter WordPress.com on Facebook WordPress.com on Instagram WordPress.com on YouTube
WordPress.com Logo and Wordmark title=

Automattic, Inc. - 60 29th St. #343, San Francisco, CA 94110  

at November 23, 2023
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Protect your peace like it's worth something.

Because, well...it is.  ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌...

  • [New post] Wiggle Kingdom: April Earnings on Spring Savings!
    Betsi...
  • [New post] Balancing the ‘E’ and ‘S’ in Environment, Social and Governance (ESG) crucial to sustaining liquidity and resilience in the African loan market (By Miranda Abraham)
    APO p...
  • Something plus something else
    Read on bl...

Search This Blog

  • Home

About Me

RelationDigest
View my complete profile

Report Abuse

Blog Archive

  • August 2025 (29)
  • July 2025 (59)
  • June 2025 (53)
  • May 2025 (47)
  • April 2025 (42)
  • March 2025 (30)
  • February 2025 (27)
  • January 2025 (30)
  • December 2024 (37)
  • November 2024 (31)
  • October 2024 (28)
  • September 2024 (28)
  • August 2024 (2729)
  • July 2024 (3249)
  • June 2024 (3152)
  • May 2024 (3259)
  • April 2024 (3151)
  • March 2024 (3258)
  • February 2024 (3046)
  • January 2024 (3258)
  • December 2023 (3270)
  • November 2023 (3183)
  • October 2023 (3243)
  • September 2023 (3151)
  • August 2023 (3241)
  • July 2023 (3237)
  • June 2023 (3135)
  • May 2023 (3212)
  • April 2023 (3093)
  • March 2023 (3187)
  • February 2023 (2865)
  • January 2023 (3209)
  • December 2022 (3229)
  • November 2022 (3079)
  • October 2022 (3086)
  • September 2022 (2791)
  • August 2022 (2964)
  • July 2022 (3157)
  • June 2022 (2925)
  • May 2022 (2893)
  • April 2022 (3049)
  • March 2022 (2919)
  • February 2022 (2104)
  • January 2022 (2284)
  • December 2021 (2481)
  • November 2021 (3146)
  • October 2021 (1048)
Powered by Blogger.