5 Useful Ways to Make BDD (Behavior-Driven Development) Work
Last Updated on
With behavior-driven development (BDD) an application’s speciﬁcations are determined using descriptions of how the software should behave. BDD is based on lean principles since all code created for the project is devoted to implementing the desired behaviors. Behavior-driven development is also well suited to use in an Agile development environment because of its ability to evolve with changing requirements. However, proper implementation of behavior-driven development is necessary to take full advantage of these benefits.
The following best practices can help ensure your organization enjoys greater productivity and efﬁciency.
#1: Keep Speciﬁcations Real
Behavior-driven development works best when business stakeholders can explain what they hope to achieve using real-world examples. The development team can easily see where incorrect assumptions are being made and thereby avoid unnecessary rework. The various scenarios discussed should cover all essential aspects of the application during typical use. Ideally, both functional and non-functional requirements should be described in terms of behavior.
#2: Delve into the Business Logic
The development team shouldn’t just be looking at separate steps. They need to grasp the underlying business rules and understand how the application is linked to business outcomes. For example, the team will have a better idea of how to design an online form if they know that it is being used to collect mandatory information from employees rather than voluntary information from customers. In the first case, convenience may be less important than enforced accuracy and completion of all required ﬁelds. In the second case, ease of use and low latency are of primary importance.
#3: Keep Stakeholders Out of the “How”
While collaboration with business stakeholders is desirable, they shouldn’t be too involved in deciding how each behavior is achieved. Otherwise, they can get overwhelmed trying to describe every action required to achieve their desired outcome. Overly detailed descriptions can also lead to a lot of ﬂuff or complex code as the development team tries to meet nonessential requirements. The design and development team should determine the details of the workflow for maximum efﬁciency.
#4: Use Examples to Create Tests
The concrete examples provided at the outset by business stakeholders should be transformed into acceptance criteria that drive all development efforts. Acceptance criteria should also be automated, resulting in test reports that demonstrate progress and show that desired behaviors are being implemented. Test reports featuring behaviors that are similar to the original examples help stakeholders provide effective feedback.
#5: Combine Testing with Documentation
Requirements often change during a software development project as stakeholders clarify the behavior they wish to see. Both testing and documentation will evolve throughout the development process. Ideally, acceptance tests should double as Living Documentation featuring descriptive language that can readily be interpreted by developers and business users. When Living Documentation is used, tests and documentation are up to date at all times – and any changes that might break the application can be readily identified.
When it is used correctly, BDD can substantially improve the software development process. By implementing the ﬁve ways outlined above, development teams can improve communication, reduce design complexity, speed deployment of functional software, and ensure the ﬁnal product truly meets business requirements.