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.

Kenny Baas-Schwegler

February 02, 2018
Tweet

More Decks by Kenny Baas-Schwegler

Other Decks in Technology

Transcript

  1. 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/
  2. … 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/
  3. 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)
  4. 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/
  5. "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/
  6. 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
  7. 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?
  8. 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?
  9. 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