top of page
priyasawant

Behavior Driven Development (BDD) with Gherkin

What is gherkins?

It is Business Readable Domain Specific language that lets you describe software behavior.

If we write test cases in simple English language then Developer and Tester might think differently. So now all started writing in BDD format using Gherkin.


Keywords - Scenario,Feature,Feature file,Scenarios outline,Step Definition


Scenario

In Cucumber Test cases are represented as Scenario.

  • Important Terms used in Gherkin

Feature

Scenario

Given

When

Then

And

But


Image copied from Test Management.com


We will see Example:

Feature:- Patient management System


Scenario 1: Validation for User Name text box

Given : Login page for patient management system is opening

When : Enter invalid User name click login button

Then : Error message should display “Invalid User name” on login page


Scenario 2: Validation for Password text box

Given : Login page for patient management system is opening

When : Enter invalid Password click login button

Then : Error message should display “Invalid Password” on login page


Scenario 3: Login functionality of patient management System

Given : Login page for patient management system is opening

When : Enter valid User name

Then : Page should accepts User name


Scenario 4: Login functionality of patient management System

Given : Login page for patient management system is opening

When : Enter valid Password

Then : Page should accepts Password


Scenario 5: Login functionality of patient management System

Given : Login page for patient management system is opening

When : Click on Login Button

Then : Page should redirected to Home page of Patients management system

Scenario 6 : Entering patient details

Given: New patient page opening

When: Click on new patient button

Then: Form for new patient should open


Scenario 7 : Verifying validation for First name text box

Given: Opened page for new patients

When: Enter invalid names in First name text box

Then: Error message should display on top of new patient page


Scenario 8 : Verifying validation for Middle name text box

Given: Opened page for new patients

When: Enter invalid names in Middle name text box

Then: Error message should display on top of new patient page


Scenario 9 : Verifying validation for Last name text box

Given: Opened page for new patients

When: Enter invalid names in Last name text box

Then: Error message should display on top of new patient page


Scenario 10 : Verifying validation for Address text box

Given: Opened page for new patients

When: Enter invalid address in Address text box

Then: Error message should display on top of new patient page


Scenario 11 : Verifying validation for Phone Number text box

Given: Opened page for new patients

When: Enter invalid data in Phone Number text box

Then: Error message should display on top of new patient page


Scenario 12 : Verifying validation for Date of birth text box

Given: Opened page for new patients

When: Enter invalid date in Date of birth text box

Then: Error message should display on top of new patient page


Scenario 13 : Filling details for new patient

Given : Page for new patients clicking on New patient button

When : Enter valid data for First name

Then : First name should accept.

Scenario 14 : Filling details for new patient

Given : Page for new patients clicking on New patient button

When : Enter valid data for Last

Then : Last name should accept.


Scenario 15 : Filling details for new patient

Given : Page for new patients clicking on New patient button

When : Enter valid data for Middle Name

Then : Last name should accept.


Scenario 16 : Filling details for new patient

Given : Page for new patients clicking on New patient button

When : Enter valid data for Date of Birth

Then : Date of Birth should accept


Scenario 17 : Filling details for new patient

Given : Page for new patients clicking on New patient button

When : Enter valid data for Address

Then : Address should accept


Scenario 18 : Filling details for new patient

Given : Page for new patients clicking on New patient button

When : Enter valid data for Phone Number

Then : Phone Number should accept


Scenario 19 : Filling details for new patient

Given : Page for new patients clicking on New patient button

When : Click on Submit button

Then : Patients information should saved successfully and page redirected to Home page


Scenario 20 : Open payment information page

Given: Home page should display with payment tab

When : Click on Payment Tab

Then : Payment Information page should open


Scenario 21 : Verifying validation for Insurance Name text box

Given: Opened page for payment information

When: Enter invalid names in Insurance name text box

Then: Error message should display on top of Payment Information page


Scenario 22 : Verifying validation for Insurance Number text box

Given: Opened page for payment information

When: Enter invalid number in Insurance Number text box

Then: Error message should display on top of Payment Information page


Scenario 23 : Verifying validation for Provider Name text box

Given: Opened page for payment information

When: Enter invalid provider name in Provider Name text box

Then: Error message should display on top of Payment Information page


Scenario 24 : Filling information on payment page

Given: Payment information page displayed

When : Select patients name from drop down list

Then: patients details like first name and last name should display


Scenario 25: Filling information on payment page

Given: Payment information page displayed

When : Enter valid Insurance name

Then: Insurance name should accept


Scenario 26 : Filling information on payment page

Given: Payment information page displayed

When : Enter valid card Number

Then: Card Number should accept


Scenario 27: Filling information on payment page

Given: Payment information page displayed

When : Enter valid provider name

Then: Provider Name should accept


Scenario 28 : Filling information on page

Given: Payment information page displayed

When: Click on Submit button

Then: Payment information should save successfully and page redirect to home page


Scenario 29: Opening medical history page

Given: Home page opened

When: Click on Medical History tab

Then: should redirect to medical history page


Scenario 30: Filling information on Medical History page

Given: Medical History page opened

When: Enter medical history if any

Then: Medical history should save to the specific patient


Scenario 31: Opening Immunization records page

Given: Home page opened

When :Click on Immunization tab

Then :All vaccinations given to that patients should displayed


Scenario 32 : Schedule appointments for new patients

Given: Home page opened

When : Click on Appointments tab

Then: Should redirect to the appointments page


Scenario 33 : Schedule appointment for new/old patient

Given : Appointment page opening

When: Check for availability

Then: All available dates should display


Scenario 34 : Schedule appointment for available dates

Given: Appointments page with available dates opening

When: Select available date as per patients requirement

Then : patient scheduled for selected date


Scenario 35: Schedule follow up appointment

Given: Appointments page with available date opening

When: Select available date as per doctors and patients requirement

Then: patients scheduled for follow up


Scenario 36: Cancelling appointment

Given :Appointment page opening

When: Select already scheduled appointment

Then : cancel or schedule new button should display


Scenario 37: Cancelling appointment

Given: Appointment page opening

When : Click on cancel button

Then: Appointment should cancel


Scenario 38 : Scheduling new for cancelled appointment

Given: Appointment page opening

When: Click on Schedule new button

Then: Available dates should open for scheduling new appointment


Scenario 39 : Check for billing information

Given : Home page opening

When : Click on Billing info tab

Then: Billing Information for specific patients should display


Scenario 40 : Check for bill paid or not

Given: Billing Information page opening for selected patients

When: Check for remaining balance is 0.

Then: Bill paid for selected patient


Now will see example using real time data.


23. Scenario: Detect Name

Given: Enter URl https://www.amazon.com/s?k=laptop&ref=nb_sb_noss

When: Click on 2020 Premium HP Stream 11 Laptop Computer 11.6" HD WLED Anti- Glare Intel Celeron Processor N4000 4GB RAM 32GB eMMC Office 365 Personal USB-C WiFi HDMI Win 10 + iCarp HDMI Cable

Then: Should display name 2020 Premium HP Stream 11 Laptop Computer 11.6" HD WLED Anti-Glare Intel Celeron Processor N4000 4GB RAM 32GB eMMC Office 365 Personal USB-C WiFi HDMI Win 10 + iCarp HDMI Cable


24. Scenario: Detect Price

Given : Enter URl https://www.amazon.com/s?k=laptop&ref=nb_sb_noss

When : Click on 2020 Premium HP Stream 11 Laptop Computer 11.6" HD WLED Anti- Glare Intel Celeron Processor N4000 4GB RAM 32GB eMMC Office 365 Personal USB-C WiFi HDMI Win 10 + iCarp HDMI Cable

Then: Should display price $349.00


25. Scenario: Detect Brand

Given : Enter URl https://www.amazon.com/s?k=laptop&ref=nb_sb_noss

When : Click on 2020 Premium HP Stream 11 Laptop Computer 11.6" HD WLED Anti- Glare Intel Celeron Processor N4000 4GB RAM 32GB eMMC Office 365 Personal USB-C WiFi HDMI Win 10 + iCarp HDMI Cable

Then: Should display price $349.00


26. Scenario: Detect Image

Given : Enter URl https://www.amazon.com/s?k=laptop&ref=nb_sb_noss

When : Click on 2020 Premium HP Stream 11 Laptop Computer 11.6" HD WLED Anti- Glare Intel Celeron Processor N4000 4GB RAM 32GB eMMC Office 365 Personal USB-C WiFi HDMI Win 10 + iCarp HDMI Cable

Then: Should display image of laptop


27. Scenario: Detect Operating system

Given : Enter URl https://www.amazon.com/s?k=laptop&ref=nb_sb_noss

When : Click on 2020 Premium HP Stream 11 Laptop Computer 11.6" HD WLED Anti- Glare Intel Celeron Processor N4000 4GB RAM 32GB eMMC Office 365 Personal USB-C WiFi HDMI Win 10 + iCarp HDMI Cable

Then: Should display operating system Windows 10


47 views

Recent Posts

See All
bottom of page