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

Domain Language throughout Tests, combining DDD and BDD

Domain Language throughout Tests, combining DDD and BDD

While software engineers are beginning to use the language of the domain (business language) more in their application code, in most tests we still see a lot of technical language. Especially when creating acceptance test for a GUI, we mostly go from gherkin to Selenium straight away! With the ever-growing culture of creating living documentation in the form of gherkin, it is evenly important to use the domain language in our test code too.

In this talk, I will explain how to combine Domain Driven Design (DDD) and Behaviour Driven Development (BDD). I will use Feature Mapping with Event Storming and Example Mapping so we can create a ubiquitous domain language that we can use in our application and test code. Using property-based testing and the Screenplay pattern, I will show several examples on how to use the domain language in test code. As a result, we have tests that are both useful for communication and serve as living documentation based on our domain language.

01abe62e641a626ed2dccc08ea2f8a14?s=128

Kenny Baas-Schwegler

February 02, 2018
Tweet

More Decks by Kenny Baas-Schwegler

Other Decks in Technology

Transcript

  1. Domain Language throughout Tests, combining DDD and BDD @kenny_baas Baasie.com

  2. None
  3. ENFP PERSONALITY (“THE CAMPAIGNER”)

  4. Curious Imaginative and open-minded, seeing all things as part of

    a big, mysterious puzzle called life. Overthink Things They look for underlying motives in even the simplest things. It’s not uncommon for ENFPs to lose a bit of sleep asking themselves why someone did what they did, what it might mean, and what to do about it. ©https://www.16personalities.com/
  5. None
  6. ©https://www.16personalities.com/

  7. None
  8. 150 km 50 km/h 50 km/h 75 km/h

  9. … he solved it in an instant, and thereby disappointed

    the questioner: “Oh, you must have heard the trick before!” “What trick?” asked von Neumann, “All I did was sum the geometric series.” http://engineering.pivotal.io/post/abstraction-or-the-gift-of-our-weak-brains/
  10. 150 km 50 km/h 50 km/h 75 km/h 1. you

    know the total time the fly is traveling (based on the trains’ relative speeds); (1:30 hour) 2. and you’re given the fly’s speed. A simple velocity calculation later, and you have the answer. (75x1.5=112.5 km)
  11. electron behavior is actually so complicated, involving complex interactions between

    quantum probabilities, electromagnetic interactions, and macroscopic electric fields, that human brains are piteously underpowered to calculate what’s going on in an individual atom. http://engineering.pivotal.io/post/abstraction-or-the-gift-of-our-weak-brains/
  12. "Let us change our traditional attitude to the construction of

    programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do" - Donald Knuth - Literate Programming “Programs must be written for people to read, and only incidentally for machines to execute.” - Hal Abelson http://engineering.pivotal.io/post/abstraction-or-the-gift-of-our-weak-brains/
  13. None
  14. None
  15. ©https://www.16personalities.com/

  16. None
  17. None
  18. ©https://www.16personalities.com/

  19. Feature: search Wikipedia Background: Given Open http://en.wikipedia.org And Do login

    Scenario: direct search article Given Enter search term 'Cucumber' When Do search Then Single result is shown for 'Cucumber' https://cucumber.io/blog/2014/03/03/the-worlds-most-misunderstood-collaboration-tool The world's most misunderstood collaboration tool
  20. Illustration by Paul Rayner (Thanks!)

  21. None
  22. All your dreams are made When you're chained to the

    mirror and the razor blade Today's the day that all the world will see Another sunny afternoon Walking to the sound of my favorite tune Tomorrow never knows what it doesn't know too soon Need a little time to wake up Need a little time to wake up wake up Need a little time to wake up Need a little time to rest your mind You know you should so I guess you might as well What's the story morning glory? Well You need a little time to wake up wake up Well What's the story morning glory?
  23. All your dreams are made When you're chained to the

    mirror and the razor blade Today's the day that all the world will see Another sunny afternoon Walking to the sound of my favorite tune Tomorrow never knows what it doesn't know too soon Need a little time to wake up Need a little time to wake up wake up Need a little time to wake up Need a little time to rest your mind You know you should so I guess you might as well What's the story morning glory? Well You need a little time to wake up wake up Well What's the story morning glory?
  24. None
  25. None
  26. "Software Development is about learning, working code is a side

    effect" Alberto Brandolini @ziobrando
  27. None
  28. None
  29. None
  30. None
  31. None
  32. ©https://www.16personalities.com/

  33. None
  34. @Acceptance Testing for Continuous Delivery - Dave Farley

  35. @Acceptance Testing for Continuous Delivery - Dave Farley

  36. None
  37. https://dddeurope.com/2017/speakers/romeu-moura/

  38. None
  39. Navigation by public transport In order to know the fastest

    route between two places, As a commuter I want get to my destination as quickly as possible
  40. None
  41. None
  42. None
  43. https://johnfergusonsmart.com/feature-mapping-a-simpler-path-from-stories-to-executable-acceptance-criteria/

  44. • Commuter • Trains

  45. http://eventstorming.com/

  46. None
  47. Choose Origin Choose Destination Origin Selected Destination Selected

  48. https://cucumber.io/blog/2015/12/08/example-mapping-introduction

  49. None
  50. None
  51. None
  52. http://serenity-js.org/design/screenplay-pattern.html

  53. None
  54. None
  55. # WRAPUP

  56. Empathy Story

  57. Questions? #CATTAX