Cucumber BDD with Selenium WebDriver and Testng Framework

Cucumber BDD with Selenium WebDriver and Testng Framework


Cucumber is a Behavior Driven Development (BDD) testing framework that helps the non technical members of the team can easily understand the scenario’s automating by testers. In Cucumber, the feature files plays very important role that contains plain English text written using gherkin language which is easy to understand. Refer to the Cucumber Basics

Cucumber-BDD using Page Object Model and Testng Framework:

1. Create a Maven Project with name as ‘cucumbermvn’. Refer to the steps->

http://total-qa.com/advanced-selenium/maven/

2. Add the following dependencies and plugins required for Cucumber,Selenium,Testng.
Refer to the dependencies for Cucumber – Java project

https://cucumber.io/docs/reference/jvm#java

3. Create a following Directory Structure for the project as mentioned below:

Cucumber - BDD,StepDefs,Selenium,Testng,Page Object Model,Maven

Cucumber – BDD,StepDefs,Selenium,Testng,Page Object Model,Maven

4. Refer to the Functional Tests OpenMRSTests.java as mentioned below:

5. Refer to the Step Definitions file LoginPage.java as mentioned below:

6. Feature file Login.feature contains the steps to be performed as part of the scenario:

7. Refer to the testng.xml file.

8. Execute the following maven command with Goals as verify to generate the Cucumber Reports.

mvn verify


Cucumber Reports,CucumberTestReport.json

Cucumber Reports,CucumberTestReport.json

Leave a Reply

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