SlideShare a Scribd company logo
Let’s cook cucumber!!
vodQA Pune 2016
Pranjali Talekar
Amit Gundiyal
Abhay Dalvi
Pranathi Birudugadda
Agenda
Welcome note, Expectation setting, Group split up
Installations
Discussion about BDD and Cucumber
Setup project framework
Hands-on workshop
Advanced Features Demo
Q&A + Feedback
#vodqa
#thoughtworks
INTRODUCTION TO BDD
BDD is...
“Behaviour-driven development is about implementing an
application by describing its behaviour from the perspective of its
stakeholders”
- Dan North
BDD (Contd…)
It is an agile software development practice that has evolved
from TDD (Test Driven Development).
The premise of BDD is to bring technology and business
together.
So, As the name suggests, the practice recommends defining
the behavior upfront and using the same to drive the product
development.
It has evolved from TDD. So there was something amiss in TDD that led to
this evolution. Right ?
No clarity of how much to test.
i.e. should we test for negative numbers, should we test for decimal etc.
There is a clear chance of missing an expected behavior of the
method while implementing it.
It is not driven through a specification or the so called desired behavior. And
because of this, the boundaries are not clear.
Why BDD ?
Mindset
Tooling support
BDD expects the desired behavior to be written in a Given,
When, Then format...
Given describes the pre-requisites for the expectation
When describes the actual steps to carry on the effect of the
expectation
Then describes the verification that the expectations were
met.
How to adopt BDD ?
Benefits of BDD
Usability
System functionality is more deliberate
Developer is placed into the paradigm of a user of the system
Fewer defects
Live documentation
Living specification
Tests describe the behaviour of the system
Higher code quality
Testable code tends to follow better design patterns ( more modular code , flexible ,
understandable etc).
Confidence
Tests cover smaller, incremental slices of the system.
Tests act as safety net covering existing functionality.
Faster Delivery
Tests allow new features to be added more easily without breaking existing ones.
Misunderstanding of requirements appear earlier in development cycle.
Popular BDD testing Tools
Cucumber (https://cucumber.io)
Jasmine (http://jasmine.github.io)
JBehave (http://jbehave.org)
Concordian (http://concordion.org)
easyb (http://easyb.org)
Lets cook cucumber !!
Introduction To Cucumber
❏ Type : Behavior driven development framework / Collaboration
tool / Test tool
❏ Written in : Ruby
❏ Operating system : Cross-platform
❏ Supports about 60+ languages
❏ Automation can be written in own favorite language ( Ruby, Java,
c#.net , JavaScript, Scala, Groovy, Jython, Python, Perl, C++ etc)
❏ Helps to execute plain text functional descriptions as automated
tests
❏ Writing scenarios before code enables programmers to be guided
by an unambiguous specification
Lets cook cucumber !!
How Cucumber executes a scenario ?
INTRODUCTION TO FRAMEWORK
Framework Ecosystem
In a tool we want...
Simplicity
because who doesn’t like simple!!
Maintainability
because everyone has been on a long running project and we
know it is hell to keep tests working
Customized
because we all have our own preferences
Speed
because we all have that need for speed
Understanding Gherkin Syntax
Feature: Cucumber mandates to write a brief feature
description of the scenarios you want to write in a feature
file.Provide a high-level description of a software feature, and
to group related scenarios.
Scenario: Before writing any scenario it also mandates the
user to write a brief scenario description.
Given/When/Then/And - Every step in your scenario would be
starting with one of them.
Example - Gherkin Syntax
Given [Pre - condition]
When [Action performed]
Then [Result]
Example:
Feature: Refund item
Scenario: John returns a faulty microwave
Given John has bought a microwave for $100
And he has a receipt
When he returns the microwave
Then John should be refunded $100
HANDS ON
Advanced Features Demo
Data driven Execution
Table driven execution
Background
Hooks
Tags
Running through CLI ( JUnit way ).
Reports
Suggested Reading
http://dannorth.net/introducing-bdd/
http://behaviourdriven.org/
http://guide.agilealliance.org/guide/bdd.html
http://dannorth.net/2012/05/31/bdd-is-like-tdd-if/
http://lizkeogh.com/behaviour-driven-development/
http://lizkeogh.com/2012/05/30/showcasing-the-language-of-bdd/
http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-
stories.html
The Cucumber Book
THANK YOU
For questions or suggestions:
vodqa-pune@thoughtworks.com
pranathi.b@thoughtworks.com
abhayda@thoughtworks.com
amit.gundiyal@thoughtworks.com
pranjalt@thoughtworks.com

More Related Content

Lets cook cucumber !!

  • 1. Let’s cook cucumber!! vodQA Pune 2016 Pranjali Talekar Amit Gundiyal Abhay Dalvi Pranathi Birudugadda
  • 2. Agenda Welcome note, Expectation setting, Group split up Installations Discussion about BDD and Cucumber Setup project framework Hands-on workshop Advanced Features Demo Q&A + Feedback
  • 5. BDD is... “Behaviour-driven development is about implementing an application by describing its behaviour from the perspective of its stakeholders” - Dan North
  • 6. BDD (Contd…) It is an agile software development practice that has evolved from TDD (Test Driven Development). The premise of BDD is to bring technology and business together. So, As the name suggests, the practice recommends defining the behavior upfront and using the same to drive the product development.
  • 7. It has evolved from TDD. So there was something amiss in TDD that led to this evolution. Right ? No clarity of how much to test. i.e. should we test for negative numbers, should we test for decimal etc. There is a clear chance of missing an expected behavior of the method while implementing it. It is not driven through a specification or the so called desired behavior. And because of this, the boundaries are not clear. Why BDD ?
  • 8. Mindset Tooling support BDD expects the desired behavior to be written in a Given, When, Then format... Given describes the pre-requisites for the expectation When describes the actual steps to carry on the effect of the expectation Then describes the verification that the expectations were met. How to adopt BDD ?
  • 9. Benefits of BDD Usability System functionality is more deliberate Developer is placed into the paradigm of a user of the system Fewer defects Live documentation Living specification Tests describe the behaviour of the system Higher code quality Testable code tends to follow better design patterns ( more modular code , flexible , understandable etc). Confidence Tests cover smaller, incremental slices of the system. Tests act as safety net covering existing functionality. Faster Delivery Tests allow new features to be added more easily without breaking existing ones. Misunderstanding of requirements appear earlier in development cycle.
  • 10. Popular BDD testing Tools Cucumber (https://cucumber.io) Jasmine (http://jasmine.github.io) JBehave (http://jbehave.org) Concordian (http://concordion.org) easyb (http://easyb.org)
  • 12. Introduction To Cucumber ❏ Type : Behavior driven development framework / Collaboration tool / Test tool ❏ Written in : Ruby ❏ Operating system : Cross-platform ❏ Supports about 60+ languages ❏ Automation can be written in own favorite language ( Ruby, Java, c#.net , JavaScript, Scala, Groovy, Jython, Python, Perl, C++ etc) ❏ Helps to execute plain text functional descriptions as automated tests ❏ Writing scenarios before code enables programmers to be guided by an unambiguous specification
  • 14. How Cucumber executes a scenario ?
  • 17. In a tool we want... Simplicity because who doesn’t like simple!! Maintainability because everyone has been on a long running project and we know it is hell to keep tests working Customized because we all have our own preferences Speed because we all have that need for speed
  • 18. Understanding Gherkin Syntax Feature: Cucumber mandates to write a brief feature description of the scenarios you want to write in a feature file.Provide a high-level description of a software feature, and to group related scenarios. Scenario: Before writing any scenario it also mandates the user to write a brief scenario description. Given/When/Then/And - Every step in your scenario would be starting with one of them.
  • 19. Example - Gherkin Syntax Given [Pre - condition] When [Action performed] Then [Result] Example: Feature: Refund item Scenario: John returns a faulty microwave Given John has bought a microwave for $100 And he has a receipt When he returns the microwave Then John should be refunded $100
  • 21. Advanced Features Demo Data driven Execution Table driven execution Background Hooks Tags Running through CLI ( JUnit way ). Reports
  • 23. THANK YOU For questions or suggestions: vodqa-pune@thoughtworks.com pranathi.b@thoughtworks.com abhayda@thoughtworks.com amit.gundiyal@thoughtworks.com pranjalt@thoughtworks.com

Editor's Notes

  1. Talk about the agenda What is BDD according to you guys?
  2. this looks professional