Behaviour-driven development (BDD) lets Agile teams build software from natural language descriptions of how it should work in different scenarios. BDD benefits business users by letting them explain what they need in their own language. They write the details of scenarios (the A, B, and C in the example below), in a way that everyone—business users, software developers, and testers—can read and understand. A scenario is a user story with a simple outline:
- Given condition (A),
- When (B) happens,
- Then so should (C).
The structure of this syntax also means that automated test platforms can read and run these descriptions.
For Agile software teams, behaviour-driven development helps them design, specify, build, and test products that meet the needs of the business. It helps everyone, but in this article, I want to focus on the benefits of BDD in Agile for business users.
Behaviour-driven development is about collaboration
At its heart, BDD is about how three groups of people work together:
- business users and product owners;
- development teams and managers;
- testers and QA engineers.
(These are the so-called “three amigos”.)
There are two key parts to behaviour-driven development:
- The specifications.
- The process for handling those specifications.
Let’s look at them in turn.
Gherkin language —specifications everyone can understand
In BDD, the “three amigos” meet and write software specifications that they all agree on. The spec are documents describing software features, so we call them feature files. We write them in Gherkin, a natural language format that works with more than 70 languages. Being a structured format, feature files are also test definitions that we can automate with the Cucumber software, which is widely used in behaviour-driven development.
Automated test frameworks are nothing new, but a technical language defines the test process. This means that only technical people can write and understand the tests. Business people must rely on others to ‘translate’ the tests into meaningful business language. Such translations are where misunderstandings and errors happen.
By contrast, with Gherkin, the people who need something and those who create it can “speak the same language”.
Cucumber software —automating BDD testing
Cucumber reads Gherkin feature files, and checks whether the software under test matches the scenario descriptions.
8 benefits of BDD for business users
- Business users can define their requirements without outside help.
- No special training—Gherkin is a natural, non-technical language that’s easy to learn.
- Fewer translation errors—development and test teams are less likely to misinterpret user requirements.
- No ‘feature creep’ or technology bias. Behaviour defines the product.
- No product silos. Everyone can understand what the product will do, and have a say in its design.
- Easier buy-in from management. We can use feature files to report to management, and get budget commitments.
- Easier acceptance testing. Testers don’t need technical training to confirm test results.
- Ready-made documentation. The specs are the docs.
While https://cucumber.io/ is the best-known BDD framework, there are others that work well with behaviour-driven development