Bdd training - v3

871 views

Published on

BDD training v3 slides

Published in: Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
871
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
28
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Bdd training - v3

  1. 1. Behavior Driven Development & Specification by Example dimanche 22 septembre 13
  2. 2. Testers Developers Domain Expert dimanche 22 septembre 13
  3. 3. dimanche 22 septembre 13
  4. 4. dimanche 22 septembre 13
  5. 5. dimanche 22 septembre 13
  6. 6. dimanche 22 septembre 13
  7. 7. Software development Steps dimanche 22 septembre 13
  8. 8. Stakeholders define objectives dimanche 22 septembre 13
  9. 9. Stakeholders define objectives Business Requirements are defined dimanche 22 septembre 13
  10. 10. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined dimanche 22 septembre 13
  11. 11. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Testers (Quality Assurance) write requirements test plan dimanche 22 septembre 13
  12. 12. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Testers (Quality Assurance) write requirements test plan dimanche 22 septembre 13
  13. 13. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan dimanche 22 septembre 13
  14. 14. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested dimanche 22 septembre 13
  15. 15. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested dimanche 22 septembre 13
  16. 16. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested defects defects defects defects defects defects defects dimanche 22 septembre 13
  17. 17. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested defects defects defects defects defects defects defects defects defects defects defects defects dimanche 22 septembre 13
  18. 18. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested defects defects defects defects defects defects defects defects defects defects defects defectsdefects defects defects defects dimanche 22 septembre 13
  19. 19. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested defects defects defects defects defects defects defects defects defects defects defects defectsdefects defects defects defectsdefects defects defects defects defects defects defects defects defects defects dimanche 22 septembre 13
  20. 20. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Pfiouuuu dimanche 22 septembre 13
  21. 21. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production dimanche 22 septembre 13
  22. 22. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application dimanche 22 septembre 13
  23. 23. That is not what I want! Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application dimanche 22 septembre 13
  24. 24. Sources of Errors/Bugs dimanche 22 septembre 13
  25. 25. Sources of Errors/Bugs Misunderstandings dimanche 22 septembre 13
  26. 26. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application dimanche 22 septembre 13
  27. 27. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application unable to define what they want dimanche 22 septembre 13
  28. 28. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application unable to define what they want don't know what they really want "now" dimanche 22 septembre 13
  29. 29. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application misunderstood the stakeholders wrong, incomplete or ambiguous requirements dimanche 22 septembre 13
  30. 30. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application misinterpret requirements dimanche 22 septembre 13
  31. 31. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application incomplete tests based on implementation not behavior dimanche 22 septembre 13
  32. 32. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application misinterpret requirements dimanche 22 septembre 13
  33. 33. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application "false positives" or "beatures" misinterpretation of application behavior dimanche 22 septembre 13
  34. 34. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application At least "6" Sources of Errors dimanche 22 septembre 13
  35. 35. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application At least "6" Sources of Errors ops issues during deployment dimanche 22 septembre 13
  36. 36. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application Stakeholder Domain Experts Testers Developers dimanche 22 septembre 13
  37. 37. Stakeholders define objectives Business Requirements are defined Functional and Technical Requirements are defined Developers design and interpret specification into code Developers write implementation tests Testers (Quality Assurance) write requirements test plan Application is tested Application is deployed in Production Users use the Application At least "6" Sources of Errors among "4" different Roles dimanche 22 septembre 13
  38. 38. Stakeholder End-users Domain Experts Testers Developers dimanche 22 septembre 13
  39. 39. dimanche 22 septembre 13
  40. 40. dimanche 22 septembre 13
  41. 41. Discuss Together As a whole team! dimanche 22 septembre 13
  42. 42. dimanche 22 septembre 13
  43. 43. dimanche 22 septembre 13
  44. 44. dimanche 22 septembre 13
  45. 45. dimanche 22 septembre 13
  46. 46. dimanche 22 septembre 13
  47. 47. dimanche 22 septembre 13
  48. 48. dimanche 22 septembre 13
  49. 49. dimanche 22 septembre 13
  50. 50. dimanche 22 septembre 13
  51. 51. No Narrative No Business Value Unnecessary Feature ! dimanche 22 septembre 13
  52. 52. dimanche 22 septembre 13
  53. 53. dimanche 22 septembre 13
  54. 54. dimanche 22 septembre 13
  55. 55. dimanche 22 septembre 13
  56. 56. Feature: Account Holder withdraws cash As an Account Holder I want to withdraw cash from an ATM So that I can get money when the bank is closed dimanche 22 septembre 13
  57. 57. Scenario: Account has sufficient funds Given the account balance is 100€ And the card is valid And the machine contains enough money When the Account Holder requests 20€ Then the ATM should dispense 20€ And the account balance should be 80€ And the card should be returned dimanche 22 septembre 13
  58. 58. Scenario: The ATM has insufficient funds Given the account balance is 100€ And the card is valid And the machine contains only 20€ When the Account Holder requests 30€ Then the ATM should say it has insufficient funds And the account balance should be 100€ And the card should be returned dimanche 22 septembre 13
  59. 59. dimanche 22 septembre 13
  60. 60. Scenario: Account has insufficient funds Given the account balance is 10€ And the card is valid And the machine contains enough money When the Account Holder requests 30€ Then the ATM should not dispense any money And the ATM should say there are insufficient funds And the account balance should still be 10€ And the card should be returned dimanche 22 septembre 13
  61. 61. dimanche 22 septembre 13
  62. 62. dimanche 22 septembre 13
  63. 63. Scenario: Wrong PIN Given the card is valid And its PIN number is "0000" When the Account Holder enters "1234" Then the ATM should say the PIN number is wrong dimanche 22 septembre 13
  64. 64. Scenario: Wrong PIN three times Given the card is valid And its PIN number is "0000" When the Account Holder enters "1234" And the Account Holder enters "4321" And the Account Holder enters "2341" Then the ATM should retain the card And the ATM should say the card has been retained dimanche 22 septembre 13
  65. 65. Scenario: Card has been disabled Given the card is disabled When the Account Holder requests 30€ Then the ATM should retain the card And the ATM should say the card has been retained dimanche 22 septembre 13
  66. 66. Scenario: Card has been disabled Given the card is disabled When the Account Holder requests 30€ Then the ATM should retain the card And the ATM should say the card has been retained dimanche 22 septembre 13
  67. 67. dimanche 22 septembre 13
  68. 68. Feature: Interpolate In order to interpolate values As an Trader I want to interpolate values in a range of Market data Why this feature ? dimanche 22 septembre 13
  69. 69. Feature: Interpolate In order to interpolate values As an Trader I want to interpolate values in a range of Market data Why this feature ? dimanche 22 septembre 13
  70. 70. Feature: Linear Interpolation In order to fill the gaps and provide a value for any maturity As a trader responsible for market-marking I want to interpolate linearly values within a range of points And I want a flat extrapolation outside of the range of points Why this feature ? dimanche 22 septembre 13
  71. 71. Scenario: Change the negotiation price from positive to negative => soulte cashflow appears and premium cashflow is modified Given an FUNKY_EXOTIC And deal way is sell And deal nature is TOMATO And trade value date is 2012/07/01 And nominal is 100 JPY And negotiation price is 0.20 JPY When I validate the deal Then there are 1 Price cashflows And there are 0 fee cashflows When I change the negotiation price to -0.3 JPY And I validate the deal Then there are 1 Price cashflows And there are 1 fee cashflows And the trade cashflow's payment date is 2012/07/01 And the trade cashflow's way is receive And the trade cashflow's amount is 30 JPY And the fee cashflow's payment date is 2012/07/01 And the fee cashflow's way is give And the fee cashflow's amount is 60 JPY What about this scenario dimanche 22 septembre 13
  72. 72. Scenario: Change the negotiation price from positive to negative => soulte cashflow appears and premium cashflow is modified Given an FUNKY_EXOTIC And deal way is sell And deal nature is TOMATO And trade value date is 2012/07/01 And nominal is 100 JPY And negotiation price is 0.20 JPY When I validate the deal Then there are 1 Price cashflows And there are 0 fee cashflows When I change the negotiation price to -0.3 JPY And I validate the deal Then there are 1 Price cashflows And there are 1 fee cashflows And the trade cashflow's payment date is 2012/07/01 And the trade cashflow's way is receive And the trade cashflow's amount is 30 JPY And the fee cashflow's payment date is 2012/07/01 And the fee cashflow's way is give And the fee cashflow's amount is 60 JPY What about this scenario d = new Deal(); d.SetWay(Sell); d.SetNature(Tomato); d.SetValueDate(new Date(...)); d.SetNominal(100, JPY); d.SetNegotiationPrice(0.20, JPY); cf = d.GetCashFlows(); AssertThat(IsEqual(...); ... dimanche 22 septembre 13
  73. 73. Scenario: Fee and Price cashflows when the negotiation price is set to a negative value Given a sell for a nominal 100 JPY on FUNKY_EXOTIC TOMATO negotiation price 0.20 JPY traded on 2012/07/01 When the middle officer validates the deal Then the trade has one Price cashflow and no Fee cashflow When the middle officer changes the negotiation price to -0.3 JPY And the middle officer validates the deal Then the trade has the following cashflows: | FlowType| Way | Amount | Currency | PaymentDate | Remarks | | Price | Receive| 30 | JPY | 2012/07/01 | 100*abs(-0.3) | | Fee | Give | 60 | JPY | 2012/07/01 | 100*2*abs(-0.3)| What about this scenario Communicate With the Business People !!! dimanche 22 septembre 13
  74. 74. dimanche 22 septembre 13
  75. 75. dimanche 22 septembre 13
  76. 76. dimanche 22 septembre 13
  77. 77. Scenario BDDFRAMEWORK GLUECODE Application http://dribbble.com/shots/685089-The-Noun-Project-Bridge bridging the gap between scenario and app. dimanche 22 septembre 13
  78. 78. GLUECODE BDDFRAMEWORK SCENARIO APPLICATION SCENARIO dimanche 22 septembre 13
  79. 79. Scenario: Account has sufficient funds Given the account balance is 100€ When the Account Holder requests 20€ Then the ATM should dispense 20€ And the account balance should be 80€ And the card should be returned SCENARIO APPLICATION GLUECODE BDDFRAMEWORK dimanche 22 septembre 13
  80. 80. Scenario: Account has sufficient funds Given the account balance is 100€ When the Account Holder requests 20€ Then the ATM should dispense 20€ And the account balance should be 80€ And the card should be returned SCENARIO APPLICATION GLUECODE BDDFRAMEWORK dimanche 22 septembre 13
  81. 81. Scenario: Account has sufficient funds Given the account balance is 100€ When the Account Holder requests 20€ Then the ATM should dispense 20€ And the account balance should be 80€ And the card should be returned SCENARIO @Given("^the account balance is (d+)€$") public void defineAccountBalanceInEuro(BigDecimal balance) { throw new PendingException("Implements me!"); } @When("^the Account Holder request (d+)€$") public void withdrawInEuro (BigDecimal amount) { throw new PendingException("Implements me!"); } @Then("^the ATM should dispense (d+)€$") public void assertMoneyDispensedInEuro (BigDecimal amount) { throw new PendingException("Implements me!"); } @Then("^the account balance should be (d+)€$") public void assertBalanceInEuro(BigDecimal amount) { throw new PendingException("Implements me!"); } GLUE CODE APPLICATION BDDFRAMEWORK dimanche 22 septembre 13
  82. 82. APPLICATION @Given("^the account balance is (d+)€$") public void defineAccountBalanceInEuro(BigDecimal balance) { account().setBalance(euro(balance)); } @When("^the Account Holder request (d+)€$") public void withdrawInEuro (BigDecimal amount) { atm().withdraw(account(), euro(amount)); } @Then("^the ATM should dispense (d+)€$") public void assertMoneyDispensedInEuro (BigDecimal amount) { TransactionLog txLog = atm().transactionLog(); Money dispensed = txLog.lastAmountDispensed(); assertThat(dispensed).isEqualTo(euro(amount)); } @Then("^the account balance should be (d+)€$") public void assertBalanceInEuro(BigDecimal amount) { Money actualBalance = account().balance(); assertThat(actualBalance).isEqualTo(euro(amount)); } GLUE CODE APPLICATION Scenario: Account has sufficient funds Given the account balance is 100€ When the Account Holder requests 20€ Then the ATM should dispense 20€ And the account balance should be 80€ And the card should be returned SCENARIO BDDFRAMEWORK dimanche 22 septembre 13
  83. 83. BDDFRAMEWORK SCENARIO APPLICATIONGLUECODE dimanche 22 septembre 13
  84. 84. dimanche 22 septembre 13
  85. 85. dimanche 22 septembre 13
  86. 86. dimanche 22 septembre 13
  87. 87. dimanche 22 septembre 13
  88. 88. dimanche 22 septembre 13
  89. 89. dimanche 22 septembre 13
  90. 90. dimanche 22 septembre 13
  91. 91. dimanche 22 septembre 13
  92. 92. dimanche 22 septembre 13
  93. 93. dimanche 22 septembre 13
  94. 94. dimanche 22 septembre 13
  95. 95. dimanche 22 septembre 13
  96. 96. dimanche 22 septembre 13
  97. 97. dimanche 22 septembre 13
  98. 98. dimanche 22 septembre 13
  99. 99. dimanche 22 septembre 13
  100. 100. dimanche 22 septembre 13
  101. 101. dimanche 22 septembre 13
  102. 102. dimanche 22 septembre 13
  103. 103. dimanche 22 septembre 13
  104. 104. You will learn to think of automated tests as executable specification that become living documentation – Mary Poppendieck dimanche 22 septembre 13
  105. 105. dimanche 22 septembre 13
  106. 106. dimanche 22 septembre 13
  107. 107. dimanche 22 septembre 13
  108. 108. dimanche 22 septembre 13
  109. 109. dimanche 22 septembre 13
  110. 110. dimanche 22 septembre 13
  111. 111. dimanche 22 septembre 13
  112. 112. dimanche 22 septembre 13

×