Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Bdd training v5.2.0 - public

489 views

Published on

Behavior Driven Development - Training slides 2016-09

Published in: Engineering
  • Nice !! Download 100 % Free Ebooks, PPts, Study Notes, Novels, etc @ https://www.ThesisScientist.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Bdd training v5.2.0 - public

  1. 1. Mastering Software Developmentarolla.fr Arnauld Loyer @aloyer /[TBD]DD/ fanboy this is a regular expression!
  2. 2. 3 Behavior Driven Development & Specification by Examples with @aloyer
  3. 3. 1. testing new functionalities 2. non-regression testing 3. having conversation 4. writing scenario and automating it 5. using Cucumber/Specflow 6. other… O For You what is BDD About? 4@aloyer
  4. 4. Exercise: Draw a 12 points Star @aloyer 5
  5. 5. @aloyer
  6. 6. Shared documents aren’t shared understanding - @jeffpatton http://www.math.u-bordeaux1.fr/~abachelo/enseignement.html
  7. 7. http://defringe.com/article/kai-ziehl Build a Shared Understanding
  8. 8. @aloyer 11 shared understanding @jeffpatton Shared documents aren’t C LN ❝
  9. 9. Exercise: Chess moves @aloyer 12 Specify the Knight movement rules https://en.wikipedia.org/wiki/Rules_of_chess#Basic_moves j
  10. 10. Exercise: Chess moves @aloyer 13 A knight moves to the nearest square not on the same rank, file, or diagonal. https://en.wikipedia.org/wiki/Rules_of_chess#Basic_moves // https://en.wikipedia.org/wiki/Knight_(chess) ❝ j
  11. 11. Exercise: Chess moves @aloyer 14 File A column of the chessboard. A specific file can be named either using its position in algebraic notation, a–h, or by using its position in descriptive notation. For example, the f-file or the king bishop file comprises the squares f1–f8 (or KB1–KB8 in descriptive notation) https://en.wikipedia.org/wiki/Glossary_of_chess#Rank Rank A row of the chessboard. In algebraic notation, ranks are numbered 1–8 starting from White's side of the board; however, players customarily refer to ranks (but not files) from their own perspectives. For example: White's king and other pieces start on his first (or "back") rank, whereas Black calls the same rank the eighth rank; j
  12. 12. Exercise: Chess moves @aloyer 15 Specify the Knight movement rules https://en.wikipedia.org/wiki/Rules_of_chess#Basic_moves jProvide some real examples ?
  13. 13. Exercise: Chess moves @aloyer 16 j a b c d e f g h 1 2 3 4 5 6 7 8 + + + + + + + + j Given a Knight located at d4 Then the Knight should be able to move to: b3, c2, b5, c6, e2, f3, e6, f5
  14. 14. Exercise: Chess moves @aloyer 17 j a b c d e f g h 1 2 3 4 5 6 7 8 + + + + + + + + j Given a Knight located at d4 Then the Knight should be able to move to: b3, c2, b5, c6, e2, f3, e6, f5 Do you need a valid game setup to check this rule? What would make impossible the Knight to go to those locations? Deliberate Discovery
  15. 15. Exercise: Chess moves @aloyer 18 j a b c d e f g h 1 2 3 4 5 6 7 8 + + + + + + + + j l n l Given a Knight located at d4 And a King located at c3 And … When the Knight attempts to move to f5 Then …
  16. 16. Exercise: Chess moves @aloyer 19 j a b c d e f g h 1 2 3 4 5 6 7 8 + + + + + + + + jGiven a Knight located at d4 And a King located at c3 And … When the Knight attempts to move to f5 Then … l n l thewhite white
  17. 17. Exercise: Chess moves @aloyer 20 j a b c d e f g h 1 2 3 4 5 6 7 8 + + + + + + + + j Given the board c3, d4, e7, g7 When the move d4-f5 is attempted Then … l n l Business Language e.g. Algebraic chess notation
  18. 18. Exercise: Chess moves @aloyer 21 j a b c d e f g h 1 2 3 4 5 6 7 8 + + + + + + + + j Given the following board -- -- -- -- -- -- -- -- -- -- -- -- bK -- bB -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- wN -- -- -- -- -- -- wK -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- When … l n l Business Language e.g. Dedicated DSL
  19. 19. Exercise: Chess moves @aloyer 22 A knight moves to the nearest square not on the same rank, file, or diagonal. https://en.wikipedia.org/wiki/Rules_of_chess#Basic_moves // https://en.wikipedia.org/wiki/Knight_(chess) ❝ j Given a Knight located at d4 Then the Knight should be able to move to: b3, c2, b5, c6, e2, f3, e6, f5 Rule Example ~ Acceptance Criteria
  20. 20. Three Amigos
  21. 21. ! !! Developper Tester/QA Domain Expert BDD is the art of using examples in conversation to illustrate behavior
  22. 22. and discover unknowns @aloyer 25 Having conversations with domain experts and using examples to gain a shared understanding of the desired behavior
  23. 23. to gain a shared understanding of the desired behavior and discover unknowns @aloyer 26 Having conversations with domain experts but conversations only are not enough Curse of Knowledge B E ? ? ?☃ ℥ http://www.nytimes.com/2007/12/30/business/30know.html?_r=1&
  24. 24. and discover unknowns @aloyer 27 Having conversations with domain experts and using examples to gain a shared understanding of the desired behavior Curse of Knowledge
  25. 25. and discover unknowns @aloyer 28 Having conversations with domain experts and using examples to gain a shared understanding of the desired behavior
  26. 26. and discover unknowns @aloyer 29 Having conversations with domain experts and using examples to gain a shared understanding of the desired behavior Ubiquitous Language
  27. 27. and discover unknowns @aloyer 30 Having conversations with domain experts and using examples to gain a shared understanding of the desired behavior Ubiquitous Language Hunt for rules and acceptance criteria
  28. 28. @aloyer 31 Exercise: Permissions Inheritance Files and subfolders can inherit permissions from a parent folder. By default, any new permissions you assign to a folder are passed on to subfolders as well. Thus, when you create a new subfolder in your My Documents folder, it inherits the permissions you've set for your profile. If you made your user profile private, the new subfolder and any files you create or store within it will be private as well. You can prevent permissions from being inherited by changing the inheritance options for a folder. You can specify that subfolders or files (or both) no longer inherit permissions that have been assigned to the parent folder containing them. Instead, only permissions you explicitly apply to files and subfolders will apply.
  29. 29. @aloyer 32 Exercise: Password Rules List Sesame Rules Examples?
  30. 30. and discover unknowns @aloyer 33 Having conversations with domain experts and using examples to gain a shared understanding of the desired behavior
  31. 31. and discover unknowns @aloyer 34 Having conversations with domain experts and using examples to gain a shared understanding of the desired behavior
  32. 32. and discover unknowns @aloyer 35 Having conversations with domain experts and using examples to gain a shared understanding of the desired behavior conversation patterns
  33. 33. having conversations is more important than capturing conversations is more important than automating conversations - Liz Keogh https://www.flickr.com/photos/ironrodart/8678383872/
  34. 34. Outside-In An Agile point of view
  35. 35. Outside-In
  36. 36. Outside-In Organisation Goal
  37. 37. Outside-In Capability/Feature
  38. 38. Outside-In User Story
  39. 39. Outside-In Acceptance Criteria
  40. 40. Outside-In Examples
  41. 41. Outside-In Automatisation
  42. 42. Outside-In TDD Implementation …
  43. 43. How @aloyer 58 Why What/Intent Rules for the conversation five why rules Tips Tips
  44. 44. @aloyer 59https://pragprog.com/magazines/2012-01/the-dude-abides
  45. 45. @aloyer 60 tap . I deliver running water hand wash hands What do I want? Why?Not how I’ll perform it Describe the task not the function Tips
  46. 46. @aloyer 61 . I What do I want? Why?Not how I’ll perform it Describe the task not the function In order to really appreciate my meal As a sea food eater I want to wash my hands afterwards Tips
  47. 47. @aloyer 62 . I What do I want? Why?Not how I’ll perform it Describe the task not the function In order to really appreciate my meal As a sea food eater I want to wash my hands afterwards In order to <achieve a vision/goal> As a <stakeholder> I want to <value> Tips
  48. 48. @aloyer 63 Behavior Behavior = Context + Action + Outcome Tips
  49. 49. @aloyer 64 Given-When-Then Then an outcome should be observed Given a context When an event happens 3 phases setup/arrange exercise/act verify/assert Tips
  50. 50. @aloyer 65 Given-When-Then Then an outcome should be observed Given a context When an event happens 3 phases setup/arrange exercise/act verify/assert behavior Tips
  51. 51. @aloyer 66 Given-When-Then Then an outcome should be observed Given a context When an event happens 3 phases Business Language Only!!! Tips
  52. 52. @aloyer 67 Exercise: Scenario Analysis Scenario: A visitor can add an item to the basket Given I am viewing a product "product/id/1" When I click "#addNowButton" Then I should see "Items added to basket" what do you think ? Tips
  53. 53. @aloyer 68 Scenario: A visitor can add an item to the basket Given I am viewing a product "product/id/1" When I click "#addNowButton" Then I should see "Items added to basket" Exercise: Scenario Analysis ??? authenticated anonymous… website? api? web-services? technical details? technical details? Tips
  54. 54. @aloyer 69 In order to ease buying As a visitor I want to be able to add item in my basket Scenario: A non authenticated visitor can add item to its basket Given I was not yet authenticated And I had no item in my basket And I was looking at the book « Living Documentation » When I add the book in my basket Then my basket should contain the book « Living Documentation » Scenario: A visitor can add an item to the basket Given I am viewing a product "product/id/1" When I click "#addNowButton" Then I should see "Items added to basket" Exercise: Scenario Analysis only 1st… 2nd… 3rd… nth draft Tips
  55. 55. @aloyer 70 In order to ease buying As a visitor I want to be able to add item in my basket Scenario: A non authenticated visitor can add item to its basket Given I was not yet authenticated And I had no item in my basket And I was looking at the book « Living Documentation » When I add the book in my basket Then my basket should contain the book « Living Documentation » Exercise: Scenario Analysis only there is already something in the basket the book was already in the basket it is the second time i visit the site anonymously… a book was in the basket but not anymore available… what if? Tips
  56. 56. @aloyer 71 Scenario: A non authenticated visitor can add item to its basket Given I was not yet authenticated And I had no item in my basket And I was looking at the book « Living Documentation » When I add the book in my basket Then my basket should contain only the book « Living Documentation » Scenario: An authenticated visitor can add item to its basket Given I was already authenticated as « Emma » And I had no item in my basket And I was looking at the book « Living Documentation » When I add the book in my basket Then my basket should contain only the book « Living Documentation » Exercise: Scenario Analysis Tips
  57. 57. How @aloyer 72 Why What/Intent What if…? use Should Business Language only Always assume you’re ignorant Provide a context for your use-case Rules for the conversation Tips Tips
  58. 58. C QExamples L O A P L LLRequirements N 3 Amigos Workshop development / tests uat @aloyer 73 when
  59. 59. http://yellowpencil.com/blog/testing-testing-1-2-3/ @aloyer 74 http://www.isixsigma.com/industries/software-it/defect-prevention-reducing-costs-and-enhancing-quality/ Relative Costs to Fix Software Defects (Source: IBM Systems Sciences Institute) autom ation
  60. 60. Examples Tests Requirements clarify can become verify @aloyer
  61. 61. Examples Tests Requirements clarify can become verify @aloyer
  62. 62. Show me some real examples!
  63. 63. @aloyer Examples of « Horse Betting » scenario
  64. 64. @aloyer Examples of « Horse Betting » scenario
  65. 65. @aloyer Scenario: Without an audit, I cannot cancel a deal with a passed value date Given I have inserted a standard OTC deal with a standard product and the following specific | price | trade date | value date | | 50 | 2014-JUL-01 | 2014-JUL-01 | When I try to cancel the deal Then I should have an error message indicating "The input is not intraday: you must provide a justification" Scenario: Volume OTC deals Given a standard option And a standard external OTC deal with the following specifics | way | quantity | | buy | 100 | When I create the option And I create the deal with the created product And I generate the report Volume OTC deals Then the deal should appear in the report Examples of « CIB » scenario
  66. 66. @aloyer Scenario: The portfolio position of an OTC option is properly impacted when a deal is created # # In financial trading, a position is a binding commitment to buy or sell a given amount # of financial instruments, such as securities, currencies or commodities, for a given price. # # The term "position" is also used in the context of finance for the amount of securities # or commodities held by a person, firm, or institution, and for the ownership status of # a person's or institution's investments. # # Note: strike is part of the unicity of the product; by using different strike value one # can ensure product is different among scenario Given a standard option with no specifics And a standard external OTC deal with the following specifics | portfolio | direction | quantity | | PR-GT-FR | buy | 100 | When I create the option And I check the position of the option in portfolio PR-GT-FR for TODAY And I create the deal with the created option Then the position of the option in portfolio PR-GT-FR for TODAY should be the checked position - 100 Examples of « CIB » scenario
  67. 67. @aloyer Scenario: ELS - insert a CLP with a rate leg and an option leg # L'ELS (Equity Linked Swap) est un produit dérivé modélisé en CLP (Combinaison linéaire de # produits) et permettant à deux parties de s’échanger des flux de performances et de # dividendes d’un sous-jacent equity contre un taux (jambe performance contre jambe taux). Given a standard ELSCL PRS with the following specifics | Start date | Maturity date | End date | | 2014/02/05 | 2014/02/13 | 2014/02/13 | And with the following legs | type | numerator | | Rate | -1 | | Option | +1 | And on the following periods (with a dedicated option for each) | Start date | Constatation date | Fixing date | Payment date | End date | | 2014/02/05 | 2014/02/05 | 2015/02/05 | 2015/02/05 | 2015/02/05 | | 2015/02/05 | 2015/02/05 | 2015/02/05 | 2016/02/09 | 2016/02/09 | | 2016/02/09 | 2016/02/09 | 2016/02/09 | 2017/02/07 | 2017/02/07 | | 2017/02/07 | 2017/02/07 | 2017/02/07 | 2018/02/06 | 2018/02/06 | | 2018/02/06 | 2018/02/06 | 2018/02/06 | 2019/02/05 | 2019/02/05 | Given a standard external ELS deal with the following specifics | Trade date | Value date | Category | | 2014/02/05 | 2014/02/05 | ELSCL | When I create the ELSCL And I create an external ELS deal with the created ELSCL Then the deal should correctly be created Examples of « CIB » scenario
  68. 68. https://mes-aides.gouv.fr/tests/ - 2015-MAR-16
  69. 69. https://mes-aides.gouv.fr/tests/ - 2015-MAR-16
  70. 70. https://mes-aides.gouv.fr/tests/ - 2015-MAR-16
  71. 71. Three Amigos Specifications Requirements Validate Examples Development Automation Living Documentation Examples Validation Non-Regression Right Software @aloyer 87

×