Behavior driven development - a recap (@ Symfony Bucharest Meetup)

download Behavior driven development - a recap (@ Symfony Bucharest Meetup)

of 36

  • date post

    28-Jan-2018
  • Category

    Technology

  • view

    189
  • download

    1

Embed Size (px)

Transcript of Behavior driven development - a recap (@ Symfony Bucharest Meetup)

  1. 1. A L I N P A N D I C H I - BEHAVIOR DRIVEN DEVELOPMENT A RECAP SOFTWARE DEVELOPER, TRAINER AND COACH @ MOZAICWORKS
  2. 2. BDD HAS GOT A BIT CONFLATED WITH ACCEPTANCE TESTING IN THE PHP COMMUNITY BECAUSE OF TOOLS LIKE BEHAT AND CODECEPTION. A R E D D I T U S E R
  3. 3. BDD IS MORE ABOUT WORKFLOW AND MINDSET RATHER THAN TOOLING. A N O T H E R R E D D I T U S E R
  4. 4. OVER TIME, BDD HAS GROWN TO ENCOMPASS THE WIDER PICTURE OF AGILE ANALYSIS AND AUTOMATED ACCEPTANCE TESTING. D A N N O R T H
  5. 5. WE MUST GO BACK TO TDD T O U N D E R S T A N D B D D . . .
  6. 6. HTTP://BLOG.THEFIREHOSEPROJECT.COM/POSTS/TEST-DRIVEN-DEVELOPMENT-RSPEC-VS-TEST-UNIT/
  7. 7. TYPICAL DEV PROBLEMS IN TDD: - W H E R E T O S T A R T - W H A T T O T E S T - W H A T N O T T O T E S T - H O W M U C H T O T E S T - W H A T T O C A L L T H E I R T E S T S - H O W T O U N D E R S T A N D W H Y A T E S T F A I L S
  8. 8. S T E P S T O W A R D S B D D TEST METHOD NAMES SHOULD BE SENTENCES 01
  9. 9. S T E P S T O W A R D S B D D TEST METHOD NAMES SHOULD BE SENTENCES 01 public class CustomerLookupTest extends TestCase { testFindsCustomerById() { } testFailsForDuplicateCustomers() { } }
  10. 10. S T E P S T O W A R D S B D D THE CONVENTION OF STARTING TEST METHOD NAMES WITH THE WORD SHOULD 02
  11. 11. S T E P S T O W A R D S B D D REMOVED ANY REFERENCE TO TESTING AND REPLACED IT WITH A VOCABULARY BUILT AROUND VERIFYING BEHAVIOUR 03
  12. 12. S T E P S T O W A R D S B D D 03 public class CustomerLookupTest extends TestCase { testFindsCustomerById() { } testFailsForDuplicateCustomers() { } } CustomerLookup - should find customer by id - should fail for duplicate customers - ...
  13. 13. S T E P S T O W A R D S B D D DISCOVERED THE CONCEPT OF BUSINESS VALUE 04
  14. 14. I HAD ALWAYS BEEN AWARE THAT I WROTE SOFTWARE FOR A REASON, BUT I HAD NEVER REALLY THOUGHT ABOUT THE VALUE OF THE CODE I WAS WRITING RIGHT NOW. D A N N O R T H
  15. 15. S T E P S T O W A R D S B D D WHATS THE NEXT MOST IMPORTANT THING THE SYSTEM DOESNT DO? 05
  16. 16. BUT THATS JUST LIKE ANALYSIS. Y O U , R I G H T N O W
  17. 17. S T E P S T O W A R D S B D D APPLY ALL OF THIS BEHAVIOUR-DRIVEN THINKING TO DEFINING REQUIREMENTS
  18. 18. S T E P S T O W A R D S B D D DEVELOP A CONSISTENT VOCABULARY FOR ANALYSTS, TESTERS, DEVELOPERS, AND THE BUSINESS ...
  19. 19. S T E P S T O W A R D S B D D ...ELIMINATING SOME OF THE AMBIGUITY AND MISCOMMUNICATION THAT OCCUR WHEN TECHNICAL PEOPLE TALK TO BUSINESS PEOPLE.
  20. 20. A S T A R T I N G P O I N T . USER STORY TEMPLATES As a [X] I want [Y] so that [Z]
  21. 21. A S T A R T I N G P O I N T . USER STORY TEMPLATES As a [X] I want [Y] so that [Z] I want [some feature] So that... [I just do, ok?]
  22. 22. A S T A R T I N G P O I N T . USER STORY TEMPLATES As an Endava employee I want to ride an elevator to my office So that I don't sweat climbing 10 floors using the stairs.
  23. 23. IT SAYS NOTHING ABOUT THE BE BEHAVIOUR OF THE ELEVATOR As an Endava employee I want to ride an elevator to my office So that I don't sweat climbing 10 floors using the stairs.
  24. 24. A STORYS BEHAVIOUR IS SIMPLY ITS ACCEPTANCE CRITERIA As an Endava employee I want to ride an elevator to my office So that I don't sweat climbing 10 floors using the stairs.
  25. 25. DESCRIBE THE ACCEPTANCE CRITERIA IN TERMS OF SCENARIOS As an Endava employee I want to ride an elevator to my office So that I don't sweat climbing 10 floors using the stairs.
  26. 26. DESCRIBE THE ACCEPTANCE CRITERIA IN TERMS OF SCENARIOS Given some initial context, When an event occurs, then ensure some outcomes.
  27. 27. ACCEPTANCE CRITERIA IN TERMS OF SCENARIOS Scenario: Given I am on the 0 floor And the elevator is on the 0 floor And a call for 3 floor is registered And a call for -1 floor is registered When I call elevator And the elevator operates Then the elevator opens door on -1 level Then the elevator opens door on 0 level Then the elevator opens door on 3 level
  28. 28. F I N A L L Y . . . ACCEPTANCE CRITERIA COULD BE EXECUTABLE
  29. 29. THE VISION IS TO HAVE A ROUND-TRIP EDITOR SO THAT BA`S AND TESTERS CAN CAPTURE STORIES IN A REGULAR TEXT EDITOR THAT CAN GENERATE STUBS FOR THE BEHAVIOUR CLASSES, ALL IN THE LANGUAGE OF THE BUSINESS DOMAIN. D A N N O R T H
  30. 30. BDD PRACTITIONERS EXPLORE, DISCOVER, DEFINE, THEN DRIVE OUT THE DESIRED BEHAVIOUR OF SOFTWARE USING CONVERSATIONS, CONCRETE EXAMPLES AND AUTOMATED TESTS. M A T T W Y N N E
  31. 31. HTTPS://TWITTER.COM/ANTONYMARCANO/STATUS/894822480141066240
  32. 32. A GROUP OF PEOPLE SPECIFYING HOW SOFTWARE SHOULD BEHAVE BEFORE IMPLEMENTING IT. D A N N O R T H
  33. 33. N O T T H I S ! HTTPS://TWITTER.COM/SEBROSE/STATUS/913080462444253184
  34. 34. C E R T A I N L Y N O T T H I S ! HTTP://LABS.IG.COM/CODE-COVERAGE-100-PERCENT-TRAGEDY
  35. 35. R E A D M O R E : HTTPS://DANNORTH.NET/INTRODUCING-BDD/ HTTP://LABS.IG.COM/CODE-COVERAGE-100- PERCENT-TRAGEDY HTTPS://WWW.YOUTUBE.COM /WATCH?V=L95DSKM5FBY HTTPS://GITHUB.COM/MSEKNIBILEL/ELEVATOR- BDD-KATA
  36. 36. T H A N K Y O U ! A L I N P A N D I C H I @ALINPANDICHI ALIN.PANDICHI@MOZAICWORKS.COM