Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Treat yourself - A tale about dogtraining and test driven development

Treat yourself - A tale about dogtraining and test driven development

Slides to my keynote at European Testing Conference 2020 in Amsterdam.
You can find the code example on github:
https://github.com/programmiri/examples-talk-tdd-dogtraining

Mirjam Aulbach

February 06, 2020
Tweet

More Decks by Mirjam Aulbach

Other Decks in Programming

Transcript

  1. Treat yourself
    A TALE ABOUT DOG TRAINING AND TEST DRIVEN
    DEVELOPMENT

    View Slide

  2. HI!
    !

    View Slide

  3. I
    !
    TESTING
    Image src: https://www.youtube.com/watch?v=dQw4w9WgXcQ

    View Slide

  4. MFW SOMEONE SAYS THEY don't like testing
    Image src: https://giphy.com/gifs/reaction-dogs-texting-RGK9jWz0t89Hy

    View Slide

  5. THE PERFECT JOB DOES NOT EXI—

    View Slide

  6. I WAS A DOG
    TRAINER

    View Slide

  7. Image src: https://giphy.com/gifs/truthorange-dog-surprised-wtf-xThuW7icYBlQZxjnyg

    View Slide

  8. SO... HOW TO
    TRAIN A DOG,
    MIRJAM?
    Original image: https://www.flickr.com/photos/lovine/5433988749

    View Slide

  9. Teach your dog
    WHAT TO DO
    Video src: https://giphy.com/gifs/cat-dog-trick-2J2XDIiYBFIu4

    View Slide

  10. Dogs do things when
    IT'S WORTH IT
    Image src: https://giphy.com/gifs/happiness-9fuvOqZ8tbZOU

    View Slide

  11. WORK WITH
    your dogs brain
    Video src: https://www.youtube.com/watch?v=EbJ5J5SE6ws

    View Slide

  12. Always have a
    POSITIVE GOAL
    Image src: https://giphy.com/gifs/cute-aww-eyebleach-2yqyKvK47qaea8IdnV

    View Slide

  13. Take the
    SMALLEST STEPS
    Image src: https://i.imgur.com/REevAsi.gifv

    View Slide

  14. BACK TO CODE
    Image src: https://i.imgur.com/REevAsi.gifv

    View Slide

  15. Test Driven
    DEVELOPMENT

    View Slide

  16. TEST DRIVEN DEVELOPMENT
    Tests first

    View Slide

  17. TEST DRIVEN DEVELOPMENT - how
    Red - Green - Refactor
    Image src: https://giphy.com/gifs/peteandpete-season-3-the-adventures-of-pete-and-3o7Z4tNIWOQWTlfGN2

    View Slide

  18. TDD CYCLE

    Write a test.

    That test fails - obviously

    Write code that makes the test pass

    Test pass!
    #
    Refactor
    Rinse and repeat!
    Image src: https://giphy.com/gifs/girl-yeah-wash-JS88XIgg7laNO

    View Slide

  19. BUT WHY?

    View Slide

  20. Image src: https://martinfowler.com/bliki/TestPyramid.html

    View Slide

  21. LET'S WRITE SOME

    tests

    View Slide

  22. DOG TRAINING SIMULATOR
    TASK
    Program to show others how to train a specific behavior to a dog.

    View Slide

  23. DOG TRAINING SIMULATOR
    USER STORY
    I have a dog and I want to teach this dog the behavior "Touch",
    using positive reinforcement as a technique.

    View Slide

  24. DOG TRAINING SIMULATOR
    INITIAL SITUATION
    - no past no conditioning
    - rewarding, neutral and punishing consequences
    - visible reactions to consequences

    View Slide

  25. DOG TRAINING SIMULATOR
    My training will be successful when...
    - I say "Touch"
    - and hold two fingers so my dog can access them,
    - my dog comes immediately and
    - with a joyful body language to me and
    - presses its nose at the two fingers shortly.

    View Slide

  26. LET'S THINK ABOUT THIS

    View Slide


  27. STOP!

    View Slide

  28. RED
    GREEN
    REFACTOR

    View Slide

  29. View Slide

  30. View Slide

  31. View Slide

  32. View Slide

  33. View Slide

  34. View Slide

  35. View Slide

  36. View Slide

  37. !"#

    View Slide

  38. View Slide

  39. View Slide

  40. View Slide

  41. View Slide

  42. Take
    little
    steps!

    View Slide

  43. View Slide

  44. View Slide

  45. View Slide

  46. View Slide

  47. View Slide

  48. View Slide

  49. View Slide

  50. View Slide

  51. !

    View Slide

  52. View Slide

  53. View Slide

  54. View Slide

  55. !

    View Slide

  56. View Slide

  57. View Slide

  58. View Slide

  59. View Slide

  60. View Slide

  61. View Slide

  62. View Slide

  63. View Slide

  64. View Slide

  65. View Slide

  66. View Slide

  67. View Slide

  68. View Slide

  69. View Slide

  70. View Slide

  71. View Slide

  72. View Slide

  73. View Slide

  74. View Slide

  75. View Slide

  76. View Slide

  77. View Slide

  78. View Slide

  79. View Slide

  80. View Slide

  81. View Slide

  82. View Slide

  83. SUMMARY

    View Slide

  84. WHAT - imho - TDD IS ABOUT
    TDD is not only a strategy for tests, it's a strategy for design.
    It helps to stay focused and keep things simple.
    It makes changes easier and refactoring safer.
    You can work in quick iterations and get in a very motivating feedback loop.

    View Slide

  85. TESTER
    !
    DEVELOPER
    How it brings us together
    - help developers to refine tests
    - build a balanced testing pyramid together
    Image src: https://giphy.com/gifs/dog-hug-sX755wvr2Q6gE

    View Slide

  86. THANKS A
    LawhoooooOT

    View Slide