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:-
- cucumber-core
- cucumber-java
- cucumber-junit
- cucumber-jvm-deps
- cucumber-reporting
- gherkin
- junit
- mockito-all
- 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:-
- 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!!
Be the first to comment.