Tips and tricks Best practice guides, FAQ & more
In a traditional software development process, developers write programs and build features, and testers then test the written pieces of software. However, businesses are now operating at a faster pace and, therefore, software development needs to keep up with business demands.
In order to guarantee software quality at this development rhythm, the traditional software development process has shifted towards more Agile methodologies. One of these is Behavior-driven development (BDD).
Behavior-driven development (BDD) is a methodology in Agile software development that aims to narrow the communication gaps between team members. In this method, the collaboration between developers, QA and non-technical or business analysts in a software project is encouraged. It encourages teams to use conversation and real-world examples to foster a better and shared understanding of how the application should behave.
The Behavior Driven Development process
It emerged from test-driven development (TDD), where tests are written before code and passing the tests is the critical driver of software development. BDD makes use of the general techniques and principles of TDD while providing all relevant teams with a shared process to collaborate on software development.
This shared process is facilitated through the use of a simple domain-specific language (DSL) using normal language constructs, such as English-like sentences, that express the behavior and expected outcomes.
Behavior-driven development makes us rethink our approach towards unit testing and acceptance testing so that we avoid issues that naturally arise.
Unit tests should be specified in terms of the desired behavior of the unit, that is the requirements set by the business. By specifying these terms in advance, we make sure that developers won’t have to revisit work because requirements were misunderstood.
In BBD, unit test names are whole sentences starting with a conditional verb – “should” – written in order of business value. At the very beginning of a feature file, we write acceptance tests using the standard agile framework of a user story:
Once the feature file has been established and agreed by the business participants, we then write the acceptance criteria to test that behavior. The acceptance criteria for a feature is written in terms of scenarios and implemented as classes. This allows for regular expressions – DSL – to map steps in a feature file to concrete actions. A scenario is written in the following format:
BBD allows for easy test automation. The suite of unit tests is continuously providing feedback to ensure that each key component is still working. The unit tests act as evergreen documentation so, in a way, the test suites also function as a regression safety net on bugs.
By using BDD as a form of test automation, companies can streamline activities in software development.
Whether you want to avoid technical time waste caused by a reluctance to refactor code, slow feedback caused by handovers and silos, or rework caused by vague requirements, BDD offers a pro-active approach to software development.
BDD is a way of working that applies in both development, as described in the above example above using unit testing, and also in QA.
Learn more about BDD in the whitepaper:
©2023, LEAPWORK. All rights reserved. Legal