Reading list Switch to dark mode

    How to Implement Cucumber with selenium

    Updated 16 July 2021

    Introduction

    Cucumber is a BDD testing framework that helps to understand the gap between software developers and business developers, we can use this to implement BDD approach with Selenium.

    BDD stands for Behaviour driven development– BDD mainly deals with the behaviour of the application, we only focus on the behaviour of the application developed. In BDD, all the requirements are written in simple english language, which is very easy to understand for all.

    Cucumber uses Gherkin keywords that are very easy to understand and tells the flow of the tests. Gherkin keywords are used in feature files to write the test flow in simple and efficient way.

    List of jar files required for cucmber:-

    1. cucumber-core
    2. cucumber-java
    3. cucumber-junit
    4. cucumber-jvm-deps
    5. cucumber-reporting
    6. gherkin
    7. junit
    8. mockito-all
    9. cobertura

    Gherkin Keywords

    Gherkin is a simple readable language that cucumber understands and describes the application flow in terms of simple steps. In cucumber, each line starts with a gherkin keyword.
    Some of the Gherkin keywords available in Cucumber are:-

    Start your headless eCommerce
    now.
    Find out More
    • Feature
    • Scenario
    • Given
    • When,Then,And,But
    • Background
    • Scenario Outline
    • Examples

    Feature File

    A feature file contains the steps in which the test execution flow is defined. A feature file has .feature file extension.

    for instance, let’s consider the file name to be My_feature_file in that case, user needs to save the feature file as My_feature_file.feature

    Feature File example:-

    Feature file to test the login functionality of a login page. @smokeTest Feature: To test the login functionality Scenario: Test login with valid credentials Given Open Firefox and navigate to Login page When valid Email ID and password is entered Then user should logged in successfully

    This was the basic concept of BDD through cucumber, in our next blog, we will focus on the parametrization concept in cucumber.

    Please share your valuable feedback in the comment section below, Keep Testing!!

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home

    Table of Content