bdd antipatterns
play

BDD Antipatterns Stories from the trenches about how not to do BDD - PowerPoint PPT Presentation

BDD Antipatterns Stories from the trenches about how not to do BDD Introductions I help teams of smart people learn to work together more efficiently, to deliver better software faster John Ferguson Smart The essence of BDD


  1. BDD Antipatterns Stories from the trenches about how not to do BDD

  2. Introductions “I help teams of smart people 
 learn to work together more efficiently, 
 to deliver better software faster” John Ferguson Smart

  3. The essence of BDD Collaborate to Using examples at And a common To deliver language to build software that discover multiple levels a shared matters requirements and understanding identify uncertainty

  4. How does it work? The developer 3 translates the requirements into software 1 The business owner The business 2 tells the business analyst writes a analyst what he wants requirements document 4 The tester translates the requirements 5 The technical into test cases writer translates the software into functional A traditional development process and technical documentation

  5. How does it work? The business analyst, The scenarios guide the the developer and the developer and act as tester elaborate the 2 automated tests requirements together. 3 They define 1 requirements as The business owner structured, English- and the business language format analyst have a "scenarios" conversation about what he needs. 5 4 The tester uses these scenarios as the basis for her tests The automated tests provide A BDD development process feedback on progress and help document the application

  6. The three forms of balance Timing Pitch Feedback

  7. Timing

  8. Antipattern #1 “Out to lunch”

  9. Antipattern #2 “The Cucumber Salad”

  10. 
 
 “The Cucumber Salad” Feature: Display customer details 
 As an user 
 I want to view the customer's personal profile 
 In order to access the personal information on the customer Scenario: Customer Profile field 'Gender' 
 Given I am logged into the application 
 And I have displayed the customer 
 When I view the customer profile on the summary screen 
 Then I should see the Gender field (field type: Dropdown - read only information) 
 Scenario: Customer Profile ‘DOB/Age' field 
 Given I am logged into the application And I have displayed the customer 
 When I view the Personal Profile on the Summary screen 
 Then I should see the DOB/Age field (DOB field type: Date, format: dd mmm yyyy - read only) (Age field type:read only - numeric) under Personal Profile 
 And it should be blank if no value returned 
 Scenario: Customer Profile 'Marital Status' field 
 Scenario: Customer Profile 'Dependents' field

  11. Antipattern #3 “Cucumber as a Test Tool”

  12. Pitch

  13. Antipattern #4 “Aimless requirements”

  14. “Aimless requirements” Feature: Display customer details 
 As a user I want to view the customer's profile details 
 So that I can see the personal information on the customer What is the real business goal? Feature: Locate a customer 
 In order to propose more relevant services to my customers 
 In order to propose more relevant services to my customers As a financial adviser 
 As a financial adviser 
 I want to view a customer's profile details What is the context of the user who needs this feature?

  15. “Aimless requirements” Feature: Authenticate using social media 
 Feature: Authenticate using social media 
 In order to access the application more easily 
 In order to access the application more easily 
 As a new user As a new user I want to authenticate using social media instead of having to provide I want to authenticate using social media instead of having to provide a username and password a username and password Scenario: Login via LinkedIn Scenario: Login via Twitter Scenario: Login via Facebook

  16. Antipattern #5 “Boring requirements”

  17. “Boring scenarios” UX concerns Scenario Outline: User tries to log on to application with invalid credentials 
 Given I am a registered user When I login as <username> with password <password> Then I should not be allowed to logon And I should see the error message <error-message> Examples: | username | password | message | | scott | | Please enter a password | | | tiger | Please enter a username | | scott | wrong | Invalid username or password | OK, but what else?

  18. Antipattern #6 “Eyes on the screen”

  19. 19 “Eyes on the screen” Scenario: User logs on to application 
 Given I am an authorised user When I enter ‘scott’ into the username field And I enter ‘tiger’ into the password field And I click on ‘login’ Then the application home page should open Scenario: User logs on to application 
 Given I am an authorised user When I login with a valid username and password When I login with a valid username and password Then I should be provided access to my accounts Then I should be provided access to my accounts

  20. Antipattern #7 “Top-heavy scenarios”

  21. Antipattern #8 “Not having all the cards”

  22. 22 “Not having all the cards” Scenario: Find a customer by various criteria 
 Given I am logged into the application 
 When I click Search 
 Then I will see search criteria options to search for the customer by customer name, date of birth, and account number Well-defined inputs Scenario: Find a customer by name 
 Given the following customers exist: 
 | id | first name | last name | 
 | 100 | Sarah-Jane | Smith | 
 | 101 | Sarah | Smith | 
 When I search for a customer using the following search criteria: 
 | name | Sarah-Jane Smith | 
 Then I should display the following customer: | id | first name | last name | 
 | 100 | Sarah-Jane | Smith | Well-defined outcomes

  23. Antipattern #9 “Scenario overload”

  24. 
 
 
 24 “Scenario overload” Scenario: The account earns 4% interest when the balance is over $10000 
 Given a bonus saver account with a end-of-month balance of 12000 
 When interest is calculated 
 Then the monthly interest earned should be 40 
 Scenario: The account earns 2% interest when the balance is less than $10000 
 Given a bonus saver account with a end-of-month balance of 9000 
 When interest is calculated 
 Then the monthly interest earned should be 15 
 Scenario: The account earns 4% interest when the balance is over $10000 and no more than $300 has been withdrawn 
 Given a bonus saver account with a end-of-month balance of 12000 
 And a previous end-of-month balance of $12300 
 When interest is calculated 
 Then the monthly interest earned should be 40 
 Scenario: The account earns 2% interest when the balance is over $10000 and more than $300 has been withdrawn 
 Given a bonus saver account with a end-of-month balance of 12000 
 And a previous end-of-month balance of $12400 
 When interest is calculated 
 Then the monthly interest earned should be 15

  25. 25 “Scenario overload” Scenario Outline: Bonus saver account Given a bonus saver account with an end-of-month balance of <balance> And a previous end-of-month balance of <previous> When the interest is calculated Then the applicable interest rate should be <rate> And <interest-earned> should be deposited into the account Examples: balance | previous | rate| earned| rule 10000 | 10000 | 4 | 33.33 | 9000 | 9000 | 2 | 15.00 | Under 10000 earns 2% 10000 | 10300 | 4 | 33.33 | Over 10000 earns 4% 9000 | 9301 | 1 | 7.5 | Under $10000 with over 300 withdrawn earns 1% 10000 | 10301 | 2 | 16.67 | Over $10000 with over $300 withdraw earns 2%

  26. 26 “Scenario overload” Scenario Outline: Bonus saver account Given a bonus saver account with an end-of-month balance of <balance> And a previous end-of-month balance of <previous-balance> When the interest is calculated Then the applicable interest rate should be <percentage-interest> And <interest-earned> should be deposited into the account Examples: balance | previous-balance | percentage | earned | 10000 | 10000 | 4 | 33.33 | 10001 | 10000 | 4 | 33.34 | 1000 | 1000 | 2 | 1.67 | 9000 | 9000 | 2 | 15.00 | 10000 | 10300 | 4 | 33.33 | 20000 | 20000 | 4 | 100 | 10000 | 10301 | 2 | 16.67 | 9000 | 9301 | 1 | 7.5 | 20000 | 20301 | 1 | 50 | 100000 | 100301 | 1 | 250 |

  27. Antipattern #10 “Cucumber test scripts”

  28. 28 “Cucumber test scripts”

  29. 29 “Cucumber test scripts”

  30. Antipattern #11 “Tech-speak Scenarios”

  31. 31 “Techie Scenarios” Scenario : Propose user branch when user logs in 
 Given I am an authorized staff member 
 When I log on using my valid credentials 
 Then the following branches should be available in the branch drop-down 
 | Branch name | 
 | George Street | 
 | Market Street | 
 | Liverpool Street |

  32. Feedback

  33. Antipattern #12 “Incommunicado scenarios”

  34. 34 “Incommunicado scenarios”

  35. 35 “Incommunicado scenarios”

  36. 36 “Incommunicado scenarios”

  37. So keep your balance! Timing Pitch Feedback

  38. Questions? John Ferguson Smart john.smart@wakaleo.com wakaleo http://www.wakaleo.com

Recommend


More recommend