Behaviour Driven Development (BDD) is an agile software development process that encourages collaboration between developers, QA and non-technical or business participants in a software development process.
BDD encourages teams to formalize a common understanding of how the application works through discussion and concrete examples. It evolved from test-driven development (TDD). Behaviour-Driven Development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a common process for collaborating on software development.
A short introduction with the familiar structure "I, as (user role), want to (plot) because (business value)".
"I, as a car owner, would like the car to set the speed limit by itself and stop at it, because that way I don't have to watch the speed and I will not be fined for speeding."
All user stories must follow some form of the following structure:
A description of each scenario in the narrative with the following structure:
Given: the initial context at the beginning of the scenario, as stated in one or more clauses;
When: the event that triggers the scenario;
Then: the expected outcome, in one or more clauses.
Acceptance criteria for our example, showing how the BDD narrative can provide a much more flexible, easy to understand and accurate approach:
"Given a speed limit and when the speed of the car reaches it, then stop close to the limit, but do not cross it".
"Given when the car is moving on the road, when the speed limit changes, then, the speed should change but not trigger a sudden force effect."
In agile development, the Product Owner, developers and testers reduce the risk of rework-type losses through a common understanding and jointly define acceptance tests, which are captured in stories, so that each participant can add the requirements of their own area (business, technology, testing, development). And because they are defined jointly, the flow of information is not compromised.
The acceptance tests can be:
"Given the speed limit, which is 50 km/h, when the car is driving on the road, then the speed drops to between 49-50 km/h per hour."
"Given the speed limit, which is 50 km/h, when the speed limit changes to 30 km/h, then the braking speed should be 5 meters per second."
There are several forms of user stories, in a later article we will look at what they look like in the FDD system.