Successfully reported this slideshow.
Your SlideShare is downloading. ×

Outside In - Behaviour Driven Development (BDD)

Outside In - Behaviour Driven Development (BDD)

Download to read offline

The BDD Workshop offers a comprehensive, hands-on introduction to behavior driven development via an interactive-demo.

Over the past decade, eXtreme Programming practices like Test-Driven Development (TDD) and Behaviour Driven Development (BDD) have fundamentally changed software development processes and inherently how engineers work. Practitioners claim that it has helped them significantly improve their collaboration with business, development speed, design & code quality and responsiveness to changing requirements. Software professionals across the board, from Internet startups to medical device companies to space research organizations, today have embraced these practices.

This workshop explores the foundations of TDD & BDD with the help of various patterns, strategies, tools and techniques.

The BDD Workshop offers a comprehensive, hands-on introduction to behavior driven development via an interactive-demo.

Over the past decade, eXtreme Programming practices like Test-Driven Development (TDD) and Behaviour Driven Development (BDD) have fundamentally changed software development processes and inherently how engineers work. Practitioners claim that it has helped them significantly improve their collaboration with business, development speed, design & code quality and responsiveness to changing requirements. Software professionals across the board, from Internet startups to medical device companies to space research organizations, today have embraced these practices.

This workshop explores the foundations of TDD & BDD with the help of various patterns, strategies, tools and techniques.

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Outside In - Behaviour Driven Development (BDD)

  1. 1. Behavior Driven Development Naresh Jain naresh@agilefaqs.com @nashjain http://nareshjain.com Copyright © 2013, AgileFAQs. All Rights Reserved.
  2. 2. Warmup Scenarios Pick one scenario and in relation to your scenario, what are the specific observable results that will tell you that the activity has been successfully completed? Going out for Movie (THX sound and Digital projection) Going out for meal (one veg.) Going shopping ($50) [5 Minutes] Present back to the group your findings. [3 minutes per group] Copyright © 2013, AgileFAQs. All Rights Reserved.
  3. 3. Commercial Break!
  4. 4. Copyright © 2013, AgileFAQs. All Rights Reserved.
  5. 5. Tech Talks!
  6. 6. Product  Discovery  -­‐  Overview Personas Elevator Business Pragmatic User Pitch Goals Personas Goals Chartering Scenarios Day in Life & of each Narratives Persona Story Mapping Activity Map Interaction UI Sketch Task Map Design Planning Grouping Reiterating Prioritization by Themes User Story Authoring Acceptance User Criteria Stories
  7. 7. Vision Elevator Business Pitch Goals Goal Chartering Personas Pragmatic User Personas Goals Capability Day in Life Scenarios & of each Narratives Persona Story Mapping Feature Activity Map UI Sketch Interaction Design Task Map Story Planning Grouping by Reiterating Scenario Prioritization Themes User Story Authoring Acceptance User Stories Criteria Code
  8. 8. User Stories What are we really trying to build? Copyright © 2013, AgileFAQs. All Rights Reserved.
  9. 9. What is a Story? Story is a smallest piece of functionality that add business value Stories should follow Ron Jeffries’ 3 Cs Card – Placeholder for conversation Conversation – Actual discussion between dev team and user Confirmation – Acceptance criteria to determine when the story is finished Copyright © 2013, AgileFAQs. All Rights Reserved.
  10. 10. Typical Story Format Story Title - Actor Action Context In order to... <user goal/business justification> As a .. <user who requires this feature> I need .. <do something> Copyright © 2013, AgileFAQs. All Rights Reserved.
  11. 11. Story Example Title: Keen Reader subscribes to a blog In order to stay up-to-date with new posts As a keen reader of your blog I need to subscribe to your blog Copyright © 2013, AgileFAQs. All Rights Reserved.
  12. 12. Another Story Example Title: Social Networking Enthusiast uploads profile picture In order for my friends to see how I look and recognize me As a Social Networking Enthusiast I need to upload my profile picture Copyright © 2013, AgileFAQs. All Rights Reserved.
  13. 13. Stories are fundamental unit of activity Business Goals Product Backlog Release Backlog Sprint Backlog Inception Release planning Iteration planning User Goals As a ____, I want to As a ____, I want to As a ____, I want to be able to ____ so be able to ____ so be able to ____ so that ____ that ____ that ____ Possible automation of the acceptance test I will know this is I will know this is done when _______ done when _______ Might have an initial estimate (perhaps for both analysis and development), Development team and an expression of breaks out the technical and business To do this I must: detail of work confidence that this is real More detailed estimate, and 1) _____ needed to pass test and achievable a specific acceptance test – 2) _____ low confidence stories might be “spiked” or prototyped Copyright © 2013, AgileFAQs. All Rights Reserved.
  14. 14. What makes a good Story? Stories should follow the INVEST principle: Independent Negotiable Valuable Estimateable Small Testable Copyright © 2013, AgileFAQs. All Rights Reserved.
  15. 15. Scenarios Acceptance Criteria Copyright © 2013, AgileFAQs. All Rights Reserved.
  16. 16. Scenario Is a set of conditions that the Story must meet for it to be accepted as complete Is typically provided by the customer or product owner. Is not a replacement for conversation. Is the results of the conversation Scenarios are NOT tests Copyright © 2013, AgileFAQs. All Rights Reserved.
  17. 17. Writing Scenarios Scenario should contain: ACTOR VERB – DESCRIBING A BEHAVIOR OBSERVABLE RESULT To accommodate pre-conditions scenarios can be expressed as Given [Precondition] When [Actor + Action] Then [Observable Result] Copyright © 2013, AgileFAQs. All Rights Reserved.
  18. 18. Example Social Networking Enthusiast uploads profile picture Given the user has a valid facebook account and a digital picture on her computer, When she uploads a picture in facebook, Then her the picture should be visible to all her friends in her network. Given an user is trying to find a friend on facebook, When the user searches for a person using their name, Then their profile picture should be displayed along with other details. In order to keep facebook's reputation intact and stay out of legal hassles As owner of facebook, I need users to upload authentic, personal profile picture Copyright © 2013, AgileFAQs. All Rights Reserved.
  19. 19. Cucumber Style BDD Feature: Login In order to access secure content As a registered user I need to authenticate myself Scenario: Login with valid credentials Given I am not logged in When I try to login with "test" and "secret" Then I should be logged in Scenario: Login with invalid credentials Given I am not logged in When I try to login with "test" and "wrongpassword" Then I should not be logged in And I should be shown error message "Invalid username or password" Copyright © 2013, AgileFAQs. All Rights Reserved.
  20. 20. Step Definition Given /^I am not logged in$/ do browser.navigate_to("http://your_url.com") end When /^I try to login with "([^"]*)" and "([^"]*)"$/ do |username, password| browser.textbox("user").value = username browser.password("password").value = password browser.submit("Login").click end Then /^I should be logged in$/ do Then /^I should not be logged in$/ do if !browser.button("Logout").exists? if !browser.submit("Login").exists? raise "Not logged in" raise "Logged in" end end end end Then /^I should be shown error message "([^"]*)"$/ do |msg| value = browser.div("errorMessage").text if value != msg raise "Incorrect message: #{value}" end end Copyright © 2013, AgileFAQs. All Rights Reserved.
  21. 21. Acceptance Criteria & Tests: Definition Acceptance Tests Acceptance Criteria + Examples (data + scenarios) Acceptance Tests Copyright © 2013, AgileFAQs. All Rights Reserved.
  22. 22. Scenarios = Executable Tests Copyright © 2013, AgileFAQs. All Rights Reserved.
  23. 23. Tasks Team members further break down each story into tasks that need to be completed to meet the acceptance criteria for the story. To accomplish this story: we start off with a simple upload and image display restrict user to only upload certain image types (gif, jpg and png) figure out where to store the image. (performant and fault-tolerant) scale down (size, resolution, etc.) of the image and so on... Copyright © 2013, AgileFAQs. All Rights Reserved.
  24. 24. Demo Copyright © 2013, AgileFAQs. All Rights Reserved.
  25. 25. BDD Copyright © 2013, AgileFAQs. All Rights Reserved.
  26. 26. Key Questions Business Facing Are we building the right product? Are we building the product right? Technology/Implementation Facing Copyright © 2013, AgileFAQs. All Rights Reserved.
  27. 27. Brian Marick’s Test Categorization Business Facing Supports Programming Critique product Technology/Implementation Facing Copyright © 2013, AgileFAQs. All Rights Reserved.
  28. 28. It Helps to Think of Tests this way... Business Facing Acceptance Testing Exploratory Testing Drives Development Critique product Low-fi prototypes UI and Usability Testing Performance Testing Unit Testing System Tests Technology/Implementation Facing Copyright © 2013, AgileFAQs. All Rights Reserved.
  29. 29. Inverting the Testing Pyramid Typical testing strategies lead to an inverted testing pyramid... Manual Checking End-to-End GUI Tests 80-90% Integration 5-15% Tests Unit Tests 1-5% Copyright © 2013, AgileFAQs. All Rights Reserved.
  30. 30. Inverting the Testing Pyramid GUI 1% Tests Performance Tests End to End 4% Security Flow Tests Tests One Layer Below GUI Workflow Tests 6% Integration Test 9% Biz Logic Acceptance Tests 10% Unit Tests 70% This is the need of the hours... Copyright © 2013, AgileFAQs. All Rights Reserved.
  31. 31. Test Driven Development Add a Test Pass Run the Test Fail TDD Rhythm - Test, Code, Refactor Make a little change Fail Run the Test Pass Refactor Copyright © 2013, AgileFAQs. All Rights Reserved.
  32. 32. Behavior Driven Development Iteration Automated Acceptance Tests P Scenario E R F O R Story Automated M Unit Test E T Automated UI N E C Tests S E T S Automated Acceptance Tests Exploratory Scenario Testing Copyright © 2013, AgileFAQs. All Rights Reserved.
  33. 33. Benefits of BDD Copyright © 2013, AgileFAQs. All Rights Reserved.
  34. 34. Why? Copyright © 2013, AgileFAQs. All Rights Reserved.
  35. 35. Better Commitment and Buy-in Focus on Business Value Copyright © 2013, AgileFAQs. All Rights Reserved.
  36. 36. Ubiquitous Domain Language Copyright © 2013, AgileFAQs. All Rights Reserved.
  37. 37. Right focus Copyright © 2013, AgileFAQs. All Rights Reserved.
  38. 38. Evolutionary Design Copyright © 2013, AgileFAQs. All Rights Reserved.
  39. 39. Breaking the Knowledge Silos in Distributed Team Copyright © 2013, AgileFAQs. All Rights Reserved.
  40. 40. Greater ROI Copyright © 2013, AgileFAQs. All Rights Reserved.
  41. 41. Predictability & Confidence Copyright © 2013, AgileFAQs. All Rights Reserved.
  42. 42. Thank you Naresh Jain naresh@agilefaqs.com Copyright © 2013, AgileFAQs. All Rights Reserved.

×