SlideShare ist ein Scribd-Unternehmen logo
1 von 20
www.unicomlearning.com

India Agile Week-2013
26-Oct-2013 at Pune

BDD in an Agile world
Gaurav Awasthi
Senior Architect and Technology Evangelist

www.agileinbusiness.com
Concept, Practice, Tools

www.unicomlearning.com

Concept, Practice and finally Tools
Concepts are beyond Practices and Tools
Good Tools are better suited to Practices which
help internalize Concepts quickly

UNICOM Presents

India Agile Week-2013
The BDD World…
 Concepts
 Write software that matters
 In close collaboration with Stakeholder

 Practices
 Writing features, scenarios
 Write executable specs

 Tools
 Cucumber
 JBehave
 RSpecs
UNICOM Presents

India Agile Week-2013

www.unicomlearning.com
BDD…by definition

www.unicomlearning.com

BDD is a second-generation,
outside-in,
multiple-stakeholder,
high-automation,
agile methodology.
It describes a cycle of interactions with well-defined
outputs, resulting in the delivery of working, tested software
that matters.
Dan North
UNICOM Presents

India Agile Week-2013
Buzzword Agnostic Benefits…

www.unicomlearning.com

• Seamless mapping between Requirement statements and
executable tests

• Specification by example
• Loose grammar of the domain
• Brings Testers/QA to the forefront of development
process
• Self verifying documentation

• Evolves behavior as the domain understanding changes
UNICOM Presents

India Agile Week-2013
Co-existence with TDD
Write a failing
feature test

BDD

www.unicomlearning.com

Write a
failing unit
test
TDD

Refactor
TDD – Develop it the
right way
BDD – Develop the right
thing
UNICOM Presents

India Agile Week-2013

Make the
test pass
And what about DDD ?
• Domain Driven Design
• Ubiquitous Language
• gives vocabulary
• Inside Out

• Behavior Driven Development
• Sentences out of the vocabulary
• Description of the behavior
• Outside In

UNICOM Presents

India Agile Week-2013

www.unicomlearning.com
The BDD Practice

www.unicomlearning.com

1. Describe the behavior in plain text – Features and Scenarios
2. Write a step definition for each Step
3. Run it and watch it fail
4. Write code to make the step pass
5. Run it again and see the step pass
6. Repeat step 2 – 5 until green like a Cuke
7. Repeat step 1 – 6 until the money runs out

UNICOM Presents

India Agile Week-2013
The Tool - Cucumber
Why Cucumber ?
• one of the least technical tools
• a very active open source project
• supports a variety of languages

UNICOM Presents

India Agile Week-2013

www.unicomlearning.com
Slicing Cucumber

www.unicomlearning.com

•

JBehave -> ported to Ruby -> RBehave -> rewritten from scratch > RSpec -> + story runner -> Cucumber -> Cucumber-JVM

•

Aslak Hellesoy ported Cucumber to Java (cucumber-jvm)

•

Cucumber comes with Ruby (the original), Java, .NET, Adobe Flex,
Python, Perl, Erlang, PHP

•

Full stack for acceptance tests include – Browser Driver and
Browser

UNICOM Presents

India Agile Week-2013
Gherkin

www.unicomlearning.com

• A Business Readable, Domain Specific Language that
Cucumber understands
• Line-based language that Cucumber uses to define
behaviors in the form of features, scenarios, and steps

• Serves 3 purposes :
•
•
•

Automated Tests
Documentation
Specs for Code to be written

• Source files have .feature extension. Single Gherkin source
file contains a description of a single feature
UNICOM Presents

India Agile Week-2013
Gherkin syntax
Feature : title

www.unicomlearning.com

 As a [ person or role who will benefit ]
 I want [ some feature ]
 So that [ benefit or value of the feature ]
UNICOM Presents

India Agile Week-2013
Gherkin syntax
Scenario : title
 Given [ some initial context ]
 When [ an event occurs]
 Then [ ensures some outcome ]
UNICOM Presents

India Agile Week-2013

www.unicomlearning.com
Example
Feature: Customer
purchases a device
• As a Customer
• I want to purchase a Bluetooth
device
• So that I can make or receive a
hands free call

www.unicomlearning.com

Scenario : Customer has a
credit note valued more
than the receipt amount
• Given the customer is on the till

• And he has a credit note of Rs
1000
• And the receipt amount is Rs 500
• When the balance amount is
paid
• Then the billing completes

UNICOM Presents

India Agile Week-2013
Cucumber Options
@RunWith(Cucumber.class)
@Cucumber.Options (
tags = “@focus”,
features= “classpath:billing.feature”
)
public class CukeRunner {
}
Some common options :
• features – path to the feature files
• glue – where to look for step definition and hooks
• tags – what tags in the features should be executed
• format – what formatters to use
• …
UNICOM Presents

India Agile Week-2013

www.unicomlearning.com
CLI Option

www.unicomlearning.com

• Several Runners
•
•
•

Command Line Interface
JUnit Runner
Android Runner

cucumber-core
cucumber-junit
cucumber-android

• java cucumber.cli.Main [options] [FILE|DIR]
•

--glue , --format, --tags, --name …

• Benefit :
•
•

Independent of JUnit
Integration with Ant

UNICOM Presents

India Agile Week-2013
Demo Code
•

Create a maven project, with cucumber-jvm related
dependencies
•

•

Feature: Withdrawing money from a User account
•
Scenario: Withdrawing money from a User's account should
reduce money in the current balance
•
Given a User has $100 in his account
•
When $50 is withdrawn from the account
•
Then the balance should be $50

Write Java wrapper class – like CukeRunner,
•

•
•
•

cucumber-core, cucumber-java, cucumber-junit

Write a Feature and a scenario with steps
•

•

www.unicomlearning.com

annotated with RunWith and Cucumber.Options

Run the class, let it fail
Implement Steps, Run again
See it green like a cuke

UNICOM Presents

India Agile Week-2013
And the debate

www.unicomlearning.com

To TDD, To BDD
or
To prefer one over the other

UNICOM Presents

India Agile Week-2013
References
•
•
•
•
•

www.unicomlearning.com

That's not BDD, that's just Cucumber by Chris Parsons
Introducing BDD by Dan North
http://dannorth.net/whats-in-a-story/ by Dan North
http://cukes.info/install-cucumber-jvm.html
http://cukes.info/api/cucumber/jvm/javadoc/cucumber/api/junit/C
ucumber.Options.html

UNICOM Presents

India Agile Week-2013
www.unicomlearning.com

Speaker name: Gaurav Awasthi
Email ID: gawasthi22@gmail.com

India Agile Week-2013
Organized by
UNICOM Trainings & Seminars Pvt. Ltd.
contact@unicomlearning.com

Weitere ähnliche Inhalte

Ähnlich wie Behaviour Driven Development - Cuking the Agile world

How to Integrate UX and Agile
How to Integrate UX and AgileHow to Integrate UX and Agile
How to Integrate UX and Agile
UserZoom
 
Browserscope oscon 2011
Browserscope oscon 2011Browserscope oscon 2011
Browserscope oscon 2011
lsimon
 

Ähnlich wie Behaviour Driven Development - Cuking the Agile world (20)

How to Integrate UX and Agile
How to Integrate UX and AgileHow to Integrate UX and Agile
How to Integrate UX and Agile
 
Evolution and History of Angular as Web Development Platform.pdf
Evolution and History of Angular as Web Development Platform.pdfEvolution and History of Angular as Web Development Platform.pdf
Evolution and History of Angular as Web Development Platform.pdf
 
Accessibility Testing - Using Asqatasun - Meetup Webinar
Accessibility Testing - Using Asqatasun - Meetup WebinarAccessibility Testing - Using Asqatasun - Meetup Webinar
Accessibility Testing - Using Asqatasun - Meetup Webinar
 
Angular Meetup 1 - Angular Basics and Workshop
Angular Meetup 1 - Angular Basics and WorkshopAngular Meetup 1 - Angular Basics and Workshop
Angular Meetup 1 - Angular Basics and Workshop
 
India agile week chennai - Agile maturity to scale for enterprise & blendin...
India agile week   chennai - Agile maturity to scale for enterprise & blendin...India agile week   chennai - Agile maturity to scale for enterprise & blendin...
India agile week chennai - Agile maturity to scale for enterprise & blendin...
 
5 Best Automation Testing Tools to Speed up Testing.pdf
5 Best Automation Testing Tools to Speed up Testing.pdf5 Best Automation Testing Tools to Speed up Testing.pdf
5 Best Automation Testing Tools to Speed up Testing.pdf
 
Canada DevOps Summit 2020 Presentation Nov_03_2020
Canada DevOps Summit 2020 Presentation Nov_03_2020Canada DevOps Summit 2020 Presentation Nov_03_2020
Canada DevOps Summit 2020 Presentation Nov_03_2020
 
Unicom DevCon - CI/CD for Asp.net core apps using Docker
Unicom DevCon - CI/CD for Asp.net core apps using DockerUnicom DevCon - CI/CD for Asp.net core apps using Docker
Unicom DevCon - CI/CD for Asp.net core apps using Docker
 
Continuous delivery @ iyzico
Continuous delivery @ iyzicoContinuous delivery @ iyzico
Continuous delivery @ iyzico
 
Cucumber_Training_ForQA
Cucumber_Training_ForQACucumber_Training_ForQA
Cucumber_Training_ForQA
 
Browserscope oscon 2011
Browserscope oscon 2011Browserscope oscon 2011
Browserscope oscon 2011
 
Managed Beans: When, Why and How
Managed Beans: When, Why and HowManaged Beans: When, Why and How
Managed Beans: When, Why and How
 
How Oracle Integrates Accessibility into the Development Process
How Oracle Integrates Accessibility into the Development ProcessHow Oracle Integrates Accessibility into the Development Process
How Oracle Integrates Accessibility into the Development Process
 
Optimus XPages: An Explosion of Techniques and Best Practices
Optimus XPages: An Explosion of Techniques and Best PracticesOptimus XPages: An Explosion of Techniques and Best Practices
Optimus XPages: An Explosion of Techniques and Best Practices
 
IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019IncQuery Server for Teamwork Cloud - Talk at IW2019
IncQuery Server for Teamwork Cloud - Talk at IW2019
 
Amazon CodeGuru - Automate Code review and Code performance monitoring
Amazon CodeGuru - Automate Code review and Code performance monitoringAmazon CodeGuru - Automate Code review and Code performance monitoring
Amazon CodeGuru - Automate Code review and Code performance monitoring
 
Journey to the center of DevOps - v6
Journey to the center of DevOps - v6Journey to the center of DevOps - v6
Journey to the center of DevOps - v6
 
Coded Automation and Autopilot.pptx
Coded Automation and Autopilot.pptxCoded Automation and Autopilot.pptx
Coded Automation and Autopilot.pptx
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
What is an Automation Framework ?
What is an Automation Framework ?�What is an Automation Framework ?�
What is an Automation Framework ?
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Behaviour Driven Development - Cuking the Agile world

  • 1. www.unicomlearning.com India Agile Week-2013 26-Oct-2013 at Pune BDD in an Agile world Gaurav Awasthi Senior Architect and Technology Evangelist www.agileinbusiness.com
  • 2. Concept, Practice, Tools www.unicomlearning.com Concept, Practice and finally Tools Concepts are beyond Practices and Tools Good Tools are better suited to Practices which help internalize Concepts quickly UNICOM Presents India Agile Week-2013
  • 3. The BDD World…  Concepts  Write software that matters  In close collaboration with Stakeholder  Practices  Writing features, scenarios  Write executable specs  Tools  Cucumber  JBehave  RSpecs UNICOM Presents India Agile Week-2013 www.unicomlearning.com
  • 4. BDD…by definition www.unicomlearning.com BDD is a second-generation, outside-in, multiple-stakeholder, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters. Dan North UNICOM Presents India Agile Week-2013
  • 5. Buzzword Agnostic Benefits… www.unicomlearning.com • Seamless mapping between Requirement statements and executable tests • Specification by example • Loose grammar of the domain • Brings Testers/QA to the forefront of development process • Self verifying documentation • Evolves behavior as the domain understanding changes UNICOM Presents India Agile Week-2013
  • 6. Co-existence with TDD Write a failing feature test BDD www.unicomlearning.com Write a failing unit test TDD Refactor TDD – Develop it the right way BDD – Develop the right thing UNICOM Presents India Agile Week-2013 Make the test pass
  • 7. And what about DDD ? • Domain Driven Design • Ubiquitous Language • gives vocabulary • Inside Out • Behavior Driven Development • Sentences out of the vocabulary • Description of the behavior • Outside In UNICOM Presents India Agile Week-2013 www.unicomlearning.com
  • 8. The BDD Practice www.unicomlearning.com 1. Describe the behavior in plain text – Features and Scenarios 2. Write a step definition for each Step 3. Run it and watch it fail 4. Write code to make the step pass 5. Run it again and see the step pass 6. Repeat step 2 – 5 until green like a Cuke 7. Repeat step 1 – 6 until the money runs out UNICOM Presents India Agile Week-2013
  • 9. The Tool - Cucumber Why Cucumber ? • one of the least technical tools • a very active open source project • supports a variety of languages UNICOM Presents India Agile Week-2013 www.unicomlearning.com
  • 10. Slicing Cucumber www.unicomlearning.com • JBehave -> ported to Ruby -> RBehave -> rewritten from scratch > RSpec -> + story runner -> Cucumber -> Cucumber-JVM • Aslak Hellesoy ported Cucumber to Java (cucumber-jvm) • Cucumber comes with Ruby (the original), Java, .NET, Adobe Flex, Python, Perl, Erlang, PHP • Full stack for acceptance tests include – Browser Driver and Browser UNICOM Presents India Agile Week-2013
  • 11. Gherkin www.unicomlearning.com • A Business Readable, Domain Specific Language that Cucumber understands • Line-based language that Cucumber uses to define behaviors in the form of features, scenarios, and steps • Serves 3 purposes : • • • Automated Tests Documentation Specs for Code to be written • Source files have .feature extension. Single Gherkin source file contains a description of a single feature UNICOM Presents India Agile Week-2013
  • 12. Gherkin syntax Feature : title www.unicomlearning.com  As a [ person or role who will benefit ]  I want [ some feature ]  So that [ benefit or value of the feature ] UNICOM Presents India Agile Week-2013
  • 13. Gherkin syntax Scenario : title  Given [ some initial context ]  When [ an event occurs]  Then [ ensures some outcome ] UNICOM Presents India Agile Week-2013 www.unicomlearning.com
  • 14. Example Feature: Customer purchases a device • As a Customer • I want to purchase a Bluetooth device • So that I can make or receive a hands free call www.unicomlearning.com Scenario : Customer has a credit note valued more than the receipt amount • Given the customer is on the till • And he has a credit note of Rs 1000 • And the receipt amount is Rs 500 • When the balance amount is paid • Then the billing completes UNICOM Presents India Agile Week-2013
  • 15. Cucumber Options @RunWith(Cucumber.class) @Cucumber.Options ( tags = “@focus”, features= “classpath:billing.feature” ) public class CukeRunner { } Some common options : • features – path to the feature files • glue – where to look for step definition and hooks • tags – what tags in the features should be executed • format – what formatters to use • … UNICOM Presents India Agile Week-2013 www.unicomlearning.com
  • 16. CLI Option www.unicomlearning.com • Several Runners • • • Command Line Interface JUnit Runner Android Runner cucumber-core cucumber-junit cucumber-android • java cucumber.cli.Main [options] [FILE|DIR] • --glue , --format, --tags, --name … • Benefit : • • Independent of JUnit Integration with Ant UNICOM Presents India Agile Week-2013
  • 17. Demo Code • Create a maven project, with cucumber-jvm related dependencies • • Feature: Withdrawing money from a User account • Scenario: Withdrawing money from a User's account should reduce money in the current balance • Given a User has $100 in his account • When $50 is withdrawn from the account • Then the balance should be $50 Write Java wrapper class – like CukeRunner, • • • • cucumber-core, cucumber-java, cucumber-junit Write a Feature and a scenario with steps • • www.unicomlearning.com annotated with RunWith and Cucumber.Options Run the class, let it fail Implement Steps, Run again See it green like a cuke UNICOM Presents India Agile Week-2013
  • 18. And the debate www.unicomlearning.com To TDD, To BDD or To prefer one over the other UNICOM Presents India Agile Week-2013
  • 19. References • • • • • www.unicomlearning.com That's not BDD, that's just Cucumber by Chris Parsons Introducing BDD by Dan North http://dannorth.net/whats-in-a-story/ by Dan North http://cukes.info/install-cucumber-jvm.html http://cukes.info/api/cucumber/jvm/javadoc/cucumber/api/junit/C ucumber.Options.html UNICOM Presents India Agile Week-2013
  • 20. www.unicomlearning.com Speaker name: Gaurav Awasthi Email ID: gawasthi22@gmail.com India Agile Week-2013 Organized by UNICOM Trainings & Seminars Pvt. Ltd. contact@unicomlearning.com

Hinweis der Redaktion

  1. What TDD does, its explanation, what it doesn’t do, and how BDD fits in
  2. Why Cucumber – least technical, very active open source project, supports variety of language