LayoutTitle

Hoverable Dropdown

Monday, March 11, 2019

Sample Behavioral Driven Development (BDD) Project for your reference



While working on Behavioral Driven Deployment (BDD) you should have the following ready in your desktop

1. Any IDE (Eclipse any versions or IntelliJ) - to develop the project
2. Latest JDK installed
3. Latest Maven installed
4. Configure Settings.xml file - You will find this file from the config folder of Maven repository that you have downloaded. Take a copy of that file and paste at the following location (at your profile path) as stated and change the information related to Proxy and repository path
Your profile path : C:\Users\<<YourLoginUserID>>\.m2
5. Then install Selenium and other 3rd party add-on's as per your project requirement, example like install Cucumber for BDD etc.,


Behavioral Driven Deployment (BDD)

In general, the BDD is a common write up written in English language with few keywords like Scenario, Scenario Outline, Given, When, Then, And, Examples etc., This language named as Gherkins language.

Example 1: Story with Test Data

Scenario Outline: TC 1 - create a order form E-commerce website
Given User launches any E-commerce website
When select a order and select Payment Mode as "<DebitCard>"
Then user will get the orderNo created for future tracking

Examples:
|DebitCard|
|123456789|
|987654321|

Example 2: Story without Test Data

Scenario : TC 1 - create a order form E-commerce website
Given User launches any E-commerce website
When select a order and perform Payment
Then user will get the orderNo created for future tracking



Here you need to start with creating feature file by writing Story/Stories using Gherkins language. Below snap shows you the Maven dependency added for Cucumber (marked as 5). Hence it allows you to write the Story (marked as 1) in the feature file.





Once you started writing each line in the feature file, the Cucumber prompt you to add each Step to the Step Definition file (marked as 2). In turn, you will have a link to the step definition for each of your feature step line.





Once you started defining the step definitions, you have to write the implementation code to each of these step definition. This step definition in turn will have link to the page definition (marked as 3). Mostly, you will be having navigation or work flow of the business logic and implementation part in the page definition.




Here after, you will have detailed code starting from the declaration of each object to code implementation.  Here you will follow Page Object Model (POM) to have a no dependency on each of your code implementation. To achieve this you will be using Setter and Getter methods (means adopting Data Encapsulation).





To have Test Data to your Story using the Examples keyword or write your own or separate utility using POI & JXL Libraries and read or write from or on to the excel sheet (marked as 4)



No comments:

Post a Comment