Get Started with Cucumber and Azure DevOps!
Published Jan 25 2021 09:25 AM 32K Views
Iron Contributor


By Anusha Ammaluru


This time we bring you a blog article about Cucumber, Selenium and Integration with Azure DevOps, let's get started and welcome to the journey to learn Cucumber.

The blog post will cover the following topics:

  • Cucumber Introduction
  • Setup Cucumber with Selenium in Eclipse
  • Cucumber Basics
  • Eclipse Integration with Azure DevOps




Cucumber Introduction

Cucumber is a tool that supports Behaviour-Driven Development(BDD). It lets us define application behavior in plain meaningful English text using a simple grammar defined by a language called Gherkin. Cucumber itself is written in Ruby, but it can be used to “test” code written in Ruby or other languages.


Cucumber is one of the most powerful tools. It offers us the real communication layer on top of a robust testing framework. The tool can help run automation tests on wide-ranging testing needs from the backend to the frontend. Moreover, Cucumber creates deep connections among members of the testing team, which we hardly found in other testing frameworks.


What is Gherkin? It is a simple, lightweight, and structured language, which uses regular spoken language to describe user requirements and scenarios. Examples of regular spoken language are English, French, and around 30 more languages. Gherkin contains a set of syntax/keywords

Feature: Defines the feature (generally a user story)

Given: Specifies the pre-condition of the test

And: Defines additional conditions of the test

Then: States the post-condition/expected result of the test


Key points to note:

  • The test is written in plain English, which is common to all the domains of your project team.
  • This test is structured that makes it capable of being read in an automated way. Thereby creating automation tests at the same time while describing the scenario.




Setup Cucumber with Selenium in Eclipse

  1. Setup java
    • Download the latest version of Java from 
      • 1.png
      • Download .exe file

      • 2.png
    • Install Java by double-clicking on the .exe file and proceed with default options
    • Set up Java Environment Path
      • Type Env in the windows search and click on the ‘Environment Variables’ option
        • 3.png
      • Click on Path in the System variables and click the ‘Edit’ button
        • 4.png
      • Add folder path where the JDK is installed and click the 'OK' button
        • 5.png
      • Go to Command Prompt and type java -version If you see a screen like below, Java is installed
        • 6.png
  2. Setup Eclipse
    • Download Eclipse Photon from, if you are going to maintain the repo in Azure DevOps, I had faced issues earlier with other bundles.
      • 7.png
    • Select Eclipse IDE for Java Developers and Install
      • 8.png
    • Launch the eclipse and select a workspace folder to save your repo
  1. Install Cucumber Plugin for Eclipse 
    • June, 2021 UPDATE: The recommended way to install cucumber is now through the Eclipse Marketplace, although installing it through the Eclipse Update Site is still an option (with the new URL).
    • Check here for all the supported ways to install Cucumber for Eclipse (
    • To install through the Eclipse Marketplace:
    • To install through the Eclipse Update Site:
      • From Eclipse, go to menu Help > Install New software
      • Work with:
      • Select the check-box for Cucumber Eclipse Plugin
      • Select Next as per the instruction shown during installation.
      • Restart your Eclipse after completion of instruction.
      • Now latest version of cucumber-eclipse plugin is installed successfully in your Eclipse.
  1.   Download Cucumber JARS from Maven Repo
    • Go to
    • Search for cucumber-core in the Central Maven Repository.
    • Download jar file
    • Similarly, search for all the below libs in the Maven repo and download JAR’s
      • 10.png
  1. Download Selenium
    • Download WebDriver Java client from Selenium website
      • 11.jpg
    • Extract the files and save it in your local folder
  1. Configure Eclipse with Cucumber and Selenium WebDriver libs
    • Go to Eclipse : File-> New -> Project -> Select Maven
      • 12.png
    • Click the 'Next' button
      • 13.png
    • Filter Cucumber and select cucumber-archetype
      • 14.png
    • Enter Group Id and Artifact Id and click the ‘Finish’ button
      • 15.png
    • Add Selenium Jars
      • Right-click on Project ‘CucumberTest > Select Properties > Java build path. Then navigate to the Libraries tab and click Add External JARs.
      • Browse to the local folder where the selenium jars are saved and select all the jars and add
        • 16.png
      • Go to the lib folder and add all the remaining Jars
        • 17.png
      • Click ok
    • Add Cucumber Jars
      • Right-click on Project ‘CucumberTest > Select Properties > Java build path. Then navigate to the Libraries tab and click Add External JARs.
      • Browse to the local folder where the cucumber jars are saved and select all the jars and add
        • 18.png
      • Click the 'Ok' button
      • Now we are all set :smiling_face_with_smiling_eyes:




Cucumber Basics

  • Cucumber Feature File
    • An entry point to the Cucumber tests. It contains a list of scenarios/test cases written in natural English language using Gherkin keywords
    • Create a package in eclipse project -> name it as ‘Features’
      • 19.jpg
    • Right-click on the ‘Features’ package and create a file -> name it as ‘DemoTest.feature’
      • 20.png
    • Add a Feature: Name and description and a scenario underneath like the below example
      • 25.png
    • Step Definitions
      • Add selenium java code in the step definition methods corresponding to feature files.
      • Sample code:

@Given("user is on home page")

 public void user_is_on_home_page() {       


 driver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS);



 @When("I click on login link")

 public void i_click_on_login_link() {

 login = new LoginPage(driver);;

 driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);


 @When("I enter username {string}")

 public void i_enter_username(String email) {

 login = new LoginPage(driver);


 driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);


 @@When("I enter password {string}"

 public void i_enter_password(String password) {

 login = new LoginPage(driver);


 driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);


 @When("I click on login button")

 public void i_click_on_login_button() {

 login = new LoginPage(driver);;

 driver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS);


 @Then("I verify the login is successful")

 public void i_verify_the_login_is_successful() {

 login = new LoginPage(driver);



Junit Test Runner Class

package runner;


import io.cucumber.junit.Cucumber;

import io.cucumber.junit.CucumberOptions;

import org.junit.runner.RunWith;



@CucumberOptions(plugin = {"pretty"},

features= "src\\test\\resources\\features" ,

glue= "stepDefinitions")

public class RunCucumberTest {



Right-click on TestRunner class and Click Run As  > JUnit Test Application

Test Run Report will be shown like this




Eclipse Integration with Azure DevOps





I have created a sample Java Maven project using the Selenium Page factory and Cucumber in GitHub This is a great place to get started with a Cucumber-based framework.

Version history
Last update:
‎Jun 03 2021 05:31 AM