Behaviour Driven Development
Behaviour Driven Development
In my talk about our new way of working I made mention of Behaviour Driven Development.
What is Behaviour Driven Development? I hear you ask
Well, BDD answers the question of how to specify desired system behaviour and focus on the business value of the requirements and achieves this by using executable specifications agreed upon by the stakeholders, defined with Gherkin statements to describe features and directly executing those statements with a testing library like Cucumber.
Behaviour Driven Development
• Test Driven Development
• Domain Specific Language
• Single Source of Truth
• Specification by Example
Clarify software requirements through concrete illustrations, fostering shared understanding and directly enabling automated tests, which reduces ambiguity and improves product quality
How we write a Specification by Example
If anyone in the room gets this reference, you get 10 points for your house
Gherkin
A ubiquitous human readable language that describes feature behaviour
(Or a pickled gourd, depending on your perspective)
Deze slide heeft geen instructies
Gherkin
Given a user has navigated to a lesson
Arrange
When a user adds an image from uploads
Act
Then the image should be visible on the slide
Assert
Deze slide heeft geen instructies
Gherkin Keywords
Feature - Provide a high-level of a software feature
Rule - Represents one business rule that should be implemented
Background - Defines steps which are run before each scenario
Scenario - A concrete example that illustrates a business rule
Given - Describes the initial context
When - Describes an event or action
Then - Describe an expected outcome or result
And, But - Break up successive Given, When and Then statements
Deze slide heeft geen instructies
How does it help us?
Deze slide heeft geen instructies
How does it help us?
Single source of truth
Removes ambiguity
Stakeholders and Developers stay on the same page
Domain Specific Language
The features described mean something to the whole team
Acceptance tests written into the specification
Better testing means better software
Deze slide heeft geen instructies
Demo
Deze slide heeft geen instructies