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 AgileUserZoom
 
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.pdfiFour Technolab Pvt. Ltd.
 
Accessibility Testing - Using Asqatasun - Meetup Webinar
Accessibility Testing - Using Asqatasun - Meetup WebinarAccessibility Testing - Using Asqatasun - Meetup Webinar
Accessibility Testing - Using Asqatasun - Meetup WebinarKeyur Shah
 
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 WorkshopNitin Bhojwani
 
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...Venkat Janardhanam, MS, MBA
 
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.pdfSerena Gray
 
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_2020Varun Manik
 
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 DockerSwaminathan Vetri
 
Continuous delivery @ iyzico
Continuous delivery @ iyzicoContinuous delivery @ iyzico
Continuous delivery @ iyzicoÜmit Ünal
 
Browserscope oscon 2011
Browserscope oscon 2011Browserscope oscon 2011
Browserscope oscon 2011lsimon
 
Managed Beans: When, Why and How
Managed Beans: When, Why and HowManaged Beans: When, Why and How
Managed Beans: When, Why and HowRussell Maher
 
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 Process3Play Media
 
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 PracticesTeamstudio
 
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 IW2019Istvan Rath
 
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 monitoringOlawale Olaleye
 
Coded Automation and Autopilot.pptx
Coded Automation and Autopilot.pptxCoded Automation and Autopilot.pptx
Coded Automation and Autopilot.pptxZellAlfeche
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorFlorian Fesseler
 
What is an Automation Framework ?
What is an Automation Framework ?�What is an Automation Framework ?�
What is an Automation Framework ?Sriram Angajala
 

Ä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

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Kürzlich hochgeladen (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

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