The Two-Part Process
Behavior-driven development is a two-part process consisting of a deliberate discovery phase and a testing phase. While most developers are familiar with testing, from test-driven development, deliberate discovery is often a new and profound experience.
The deliberate discovery phase brings together key stakeholders to have conversations and come up with concrete examples. Product owners, business analysts, domain experts, users, developers, UX designers, testers, ops engineers, and others meet to come up with concrete examples of user stories and acceptance criteria. These examples ultimately become the automated tests and living documentation showing how the software behaves.
The testing phase is where concrete examples become software. Using a BDD framework and DSL, the natural language used to describe the concrete examples in the deliberate discovery phase is converted into an executable specification. Developers write code to make these tests pass, which eliminates rework caused by vague requirements, slow feedback cycles, and other problems that commonly arise in non-BDD scenarios.
These BDD tests, focused on business-facing features, work in conjunction with TDD tests, which focus on lower level implementation details.
Where It Fits in Development
In the Agile development cycle, BDD processes usually take place when you’d normally come up with acceptance criteria. The process involves converting these acceptance criteria into concrete examples and automated tests before putting them into the development pipeline. Developers can then use the automated tests to drive their development process rather than trying to write code based on potentially vague acceptance criteria.