anand bagmar - behavior driven testing (bdt) in agile
DESCRIPTION
I delivered this talk in SiliconIndia's SoftTec 2012 on 14th July 2012. I introduce Behavior Driven Testing (BDT) with a couple of examples, the different ways of writing the tests in Imperative and Declarative style, the value proposition of BDT, and how BDT can help you build a very good safety net using Test Automation suite.TRANSCRIPT
![Page 1: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/1.jpg)
Behavior Driven Tes.ng (BDT) in
Agile
![Page 2: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/2.jpg)
What is Tes*ng on Agile projects?
![Page 3: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/3.jpg)
Story planning and
wri/ng
IPM
QA kickoff
Story kickoff
Test Scenario Wri/ng
Implement Test
Automa/on
BA / QA Volleyball
Manual + Exploratory Tes/ng
Automa/on (execu/on,
maintenance)
Showcase
Agile Tes.ng in an Itera.on
![Page 4: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/4.jpg)
A prac*ce that makes Agile Teams successful?
Test Automa.on
![Page 5: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/5.jpg)
A prac*ce that makes Agile Teams unsuccessful?
Test Automa.on
![Page 6: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/6.jpg)
• “Succeeding with Agile” – Mike Cohn
• Mar*n Fowler – Test Pyramid – hCp://mar*nfowler.com/bliki/TestPyramid.html
The Test Pyramid
![Page 7: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/7.jpg)
Func/onal Tests (GUI) • Developers & / QA team
API Tests • Developers & / QA team
Integra/on tests • Developers
Component tests • Developers
Unit Tests • Developers
Cost / Effort Time
Ideal Test Pyramid
![Page 8: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/8.jpg)
![Page 9: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/9.jpg)
Test Pyramid reality
Development team Test Pyramid QA team
Test Pyramid
![Page 10: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/10.jpg)
Test Pyramid – An* PaCern
![Page 11: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/11.jpg)
Evolu*on of Test Frameworks Behavior Driven
Development (BDD)
Op/mized scripts
Record & Playback
Core Framework
![Page 12: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/12.jpg)
Behavior Driven Development (BDD)
![Page 13: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/13.jpg)
RED
GREEN REFACTOR
![Page 14: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/14.jpg)
Behavior Driven Tes*ng (BDT)
![Page 15: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/15.jpg)
Expected Func/onality:
The customer should be able to withdraw money from his account via an ATM machine
![Page 16: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/16.jpg)
Given the account has balance of 5000 When the customer requests 1000 Then the account is debited by 1000
BDD Example:
![Page 17: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/17.jpg)
Given the account is in credit
And the dispenser contains cash
When the customer requests cash
Then ensure the account is debited
And ensure cash is dispensed
And ensure the card is returned
BDT Example:
![Page 18: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/18.jpg)
New Expected Func/onality:
The customer should be able to withdraw money from his account only if his card is valid
![Page 19: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/19.jpg)
Given the account is in credit And the card is valid And the dispenser contains cash When the customer requests cash Then ensure the account is debited And ensure cash is dispensed And ensure the card is returned
BDT Example -‐ updated:
![Page 20: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/20.jpg)
Case Study
![Page 21: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/21.jpg)
![Page 22: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/22.jpg)
Requirements
• Guest User is able to search for a flight for a single traveller
• Ability to specify contact informa*on for person booking the flight
![Page 23: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/23.jpg)
Search Search Results
Contact Informa/on
![Page 24: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/24.jpg)
![Page 25: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/25.jpg)
![Page 26: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/26.jpg)
Contact Details
![Page 27: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/27.jpg)
Test specifica*on styles
• Impera*ve • Declara*ve
![Page 28: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/28.jpg)
Impera*ve style Given I am a guest user on the Indigo home page And I select “round” trip op*on And I select “Pune” from the origin dropdown And I select “Bangalore” from the des*na*on drop down And I select departure date as “5 July 2012” And I select returning date as “25 July 2012” When I click on Search Then I should see the search results page And I should see at least 1 op*on for my criteria ...
![Page 29: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/29.jpg)
… When I select the “first” op*on Then I am on the Contact Informa*on page When I enter first name as “foo” And I enter last name as “bar” … … And I click the “Select and Con/nue” buCon Then I should be on the next page
![Page 30: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/30.jpg)
Given I am a guest user When I search for flight op*ons for a “one-‐way” trip for “1” “Adult” from “Delhi” to “Bangalore” And I select the “first” flight And I enter “valid” contact details for “traveller1” Then I am able to Save and Con*nue
Declara*ve style
![Page 31: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/31.jpg)
Func/onal Tests (GUI) • Developers & / QA team
API Tests • Developers & / QA team
Integra/on tests • Developers
Component tests • Developers
Unit Tests • Developers
![Page 32: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/32.jpg)
What does BDT do for me?
![Page 33: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/33.jpg)
What BDT does NOT do for me?
• Replace tes*ng granular func*onality – ONLY when it has just been developed
![Page 34: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/34.jpg)
Steps to follow to implement BDT
![Page 35: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/35.jpg)
![Page 36: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/36.jpg)
![Page 37: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/37.jpg)
![Page 38: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/38.jpg)
![Page 39: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/39.jpg)
Current state Tests running on Hudson / Jenkins Since 1st test was automated
Feature files 33
Scenarios 65
Smoke tests execu*on *me 15 minutes
Regression tests execu*on *me 45 minutes
Test case repository (manual + automated)
Cucumber .feature files with appropriate tagging
Project Management tool Mingle
![Page 40: Anand Bagmar - Behavior Driven Testing (BDT) in Agile](https://reader033.vdocuments.mx/reader033/viewer/2022052410/554f42fdb4c90572088b542c/html5/thumbnails/40.jpg)
Tools to enable BDD / BDT
• Cucumber • JBehave • SpecFlow • Twist