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.

Doodle Driven Development

121 views

Published on

Having a good example-driven conversation can be messy. Humans scribble on whiteboards, rip up index cards, and stick things to the wall.

Automating examples brings huge benefits, but forcing them into linear Gherkin doesn't always feel natural. We'll explore some more natural visual formats for examples, and how they can practically be used to drive tests.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Doodle Driven Development

  1. 1. DoodleDriven Development CiaranMcNulty@Cukenfest2019
  2. 2. IlikeDraw-ers @ruby_gem @jennyjmar @mattwynne
  3. 3. Discovery ↓! Formulation ↓ ! Automation
  4. 4. Conversations ↓! Gherkin/G-W-T ↓ ! Cucumber
  5. 5. Drawings ↓ ! ? ↓ ! ?
  6. 6. ! Discoveringwhat's important
  7. 7. Scenario: Present for full amount Given I have a pending transaction for £100 When a presentment for £100 is received Then I should have a completed transaction for £100 Scenario: Present for less than full amount Given I have a pending transaction for £100 When a presentment for £50 is received Then I should have a completed transaction for £50 And I should have a pending transaction for £50
  8. 8. 1picture=1000words Joel Goodman/M.E.N.
  9. 9. Effectivediscoverywithdrawings · Create the conditions where it can happen · Pick the right formats · Don't force it
  10. 10. ! Formulating diagrams
  11. 11. Gherkinisgreat: 1. Looks like the conversation 2. Trackable in VCS 3. Parseable by machines
  12. 12. Potentialformats · HTML+SVG+CSS · Mermaid.js · Asciio · Asciitosvg · GraphViz
  13. 13. Graphviz digraph { "No transactions" -> "Pending £100" [label="£100 Authorisation"]; "Pending £100" -> "Completed £110" [label="£110 Presentment"]; "Pending £100" -> "Completed £50 n Pending £50" [label="£50 Presentment"]; "Completed £50 n Pending £50" -> "Completed £50 n Completed £50" [label="£50 Presentment"]; "Pending £100" -> "Completed £100" [label="£100 Presentment"]; "Completed £100" -> "Completed £100 n Completed £100" [label="£100 Presentment"]; }
  14. 14. Contextualise
  15. 15. Effectiveformulation · Find a format that is 'close enough' · Try and forget the tools during discovery · Sync based on mtime
  16. 16. Drawings ↓! Appropriateformats ↓ ! ?
  17. 17. ! Automating diagrams
  18. 18. digraph { "No transactions" -> "Pending £100" [label="£100 Authorisation"]; "Pending £100" -> "Completed £110" [label="£110 Presentment"]; "Pending £100" -> "Completed £50 n Pending £50" [label="£50 Presentment"]; "Completed £50 n Pending £50" -> "Completed £50 n Completed £50" [label="£50 Presentment"]; "Pending £100" -> "Completed £100" [label="£100 Presentment"]; "Completed £100" -> "Completed £100 n Completed £100" [label="£100 Presentment"]; }
  19. 19. foreach (file('/presentment.dot') as $line) { if (!preg_match('/->/', $line)) { continue; } $pattern = '/"(?<start>.*)".*->.*"(?<end>.*)".*label="(?<transition>.*?)"/'; if (!preg_match($pattern, $line, $matches)) { throw new Exception ("Cannot parse line:n$line"); } $this->setUp($matches['start']); $this->applyEvent($matches['end']); $this->assertEndState($matches['transition']); }
  20. 20. Effectiveautomation · Cheat the format · Do the easiest thing that works · Write brittle tests
  21. 21. ! Domoredrawing! Findmachineformats! Writescrappytests
  22. 22. Onemorething: Exploratorytesting
  23. 23. CiaranMcNulty · ciaran@crania.uk · @BDDLondon

×