BDD - beyond: Given, When and Then


Published on

Behaviour Driven Development (BDD) is an evolution of test-driven development that places explicit emphasis on language, communication and 'outside-in' development. Many people are familiar with the 'Given,When,Then' structure used in BDD specifications (or acceptance tests) but is that really where it ends? In this session Antony Marcano gives a short intro to BDD, explains 'outside-in' development. Using a metaphor from learning theory and HCI principles, he'll show you how to go beyond 'Given,When,Then' to a shared understanding of
your customer's needs.

Published in: Technology
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Requirements are given to BA as examplesBA infers Abstract RulesDevelopers code Abstract Rules (they test by inferring examples from the rules)Testers use BA rules and the software to infer new examples (edge cases)
  • At this point we should demonstrate so people can follow
  • BDD - beyond: Given, When and Then

    1. 1. Behaviour Driven DevelopmentBeyond “Given, When, Then”<br />Antony Marcano<br />
    2. 2. The Telephone Game<br /><br />
    3. 3. What is BDD?<br />Beyond “Given, When, Then”<br />
    4. 4. BDD Origins<br />‘The deeper I got into TDD, the more I felt that my own journey had been less of a wax-on, wax-off process of gradual mastery than a series of blind alleys. I remember thinking “If only someone had told me that!”… <br /> I decided it must be possible to present TDD in a way that gets straight to the good stuff and avoids all the pitfalls. My response is behaviour-driven development (BDD). <br /> Over time, BDD has grown to encompass the wider picture of agile analysis and automated acceptance testing.’<br />-Dan North<br />
    5. 5. BDD Origins - Shortened<br />“ Behaviour Driven Development (BDD) builds upon Test-Driven Development (TDD) by formalising the good habits of the best TDD practitioners. ” – The Cucumber Book, AslakHellesøy, Matt Wynne<br />
    6. 6. Some ‘Good Habits’<br />Slice Vertically<br />Work from the outside-in<br />One example at a time<br />
    7. 7. Slice Vertically<br />
    8. 8. 2009<br />8<br />Traditionally, development is sliced horizontally<br />Private albums<br />Share photos<br />Create album<br />Login<br />User Story C<br />User Story B<br />User Story D<br />User Story A<br />Software Components<br />(modules/classes)<br />Software Components<br />(modules/classes)<br />Iteration n<br />Iteration x<br />Iteration n+1…<br />Sprint n<br />Sprint x<br />Sprint n+1…<br />time<br />time<br />…but defers feedback (often, until it’s too late)<br />
    9. 9. 2009<br />9<br />Vertical slicing<br />Private albums<br />Share photos<br />Create album<br />Login<br />Share photos<br />Create album<br />Share photos<br />Software Components<br />(modules/classes)<br />Iteration n<br />Iteration x<br />Iteration n+1<br />time<br />…results in earlier feedback<br />
    10. 10. Work from the outside-in<br />
    11. 11. Outside-in<br />
    12. 12. One example at a time<br />
    13. 13. One example at a time<br />
    14. 14. Implement story<br /> driving with unit tests<br />Scenario should pass<br />Have a conversation<br />For each <br />Example illustrating the story<br />Elaborate as an<br />automated<br /> scenario <br />(aka acceptance<br /> test)<br />When all <br />Scenarios pass, <br />story is done<br />(almost)<br />One example at a time<br />Test should fail<br />
    15. 15. Expressing Examples<br />Given, When, Then<br />And beyond<br />
    16. 16. Given When Then<br /> Given <some initial context><br /> When <something happens><br /> Then <some expectation><br />
    17. 17. Given When Then<br /> Given <some initial context><br /> [and some additional context]<br /> When <something happens><br /> [and something else happens]<br /> Then <some expectation><br /> [and some more expectations]<br />
    18. 18. A Typical Illustration<br />Scenario: Login Successfully<br />Given I am on the home-page<br />When I enter the username ‘antony’<br />And I enter the password ‘p4$$w0rd’<br />And I click ‘login’<br />Then I should be logged in<br />What’s wrong with this example?<br />
    19. 19. A Better Illustration<br />Scenario: Login Successfully<br />When I login as ‘antony’ with the password ‘p4$$w0rd’<br />Then I should be logged in<br />Why is it better?<br />
    20. 20. Task Analysis<br />A little UX for our BDD<br />
    21. 21. Pitching it right…<br />Goals e.g. Withdraw Cash<br />Tasks Identify to bank<br /> Request amount<br />(inter)actions<br /> Insert Card<br /> Enter Pin<br /> Press “Withdraw Cash” <br /> Enter amount<br /> Press OK<br />}<br />Just right<br />}<br />Too low level<br />
    22. 22. For example…<br />When Iadd, the number ‘2’ and the number ’3’<br />task<br />}<br />actions<br /><br />
    23. 23. Some nice side-effects<br />Encourages description <br />of UI interactions in one place<br />Makes it easier to execute scenarios<br />via different interfaces<br />
    24. 24. Discussion<br />Questions?<br />Ideas?<br />Feedback?<br />
    25. 25. @AntonyMarcano<br /> @RiverGlide/rs<br /><br /> #cukesalad<br /> @RiverGlide<br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.