What is BDD (Behavior-Driven Development)?
Behavior-driven development is a testing practice that follows the idea of specification by example (e.g., Test-Driven Development [TDD]). The idea is to describe how the application should behave in a very simple user/business-focused language. BDD’s business-focused perspective on application behavior allows teams to create living documentation that is easy to maintain and can be consumed by all team members, including testers, developers, and product owners.
With BDD, tests are created using the gherkin Given-When-Then language.
- given (some context)
- when (something happens)
- then (outcome)
For example:
- Given I am signing up for a free trial
- When I submit the required details
- Then I receive a link to the download
BDD can be used in concert with most automated testing methodologies and tools.
BDD and Continuous Testing
BDD is one technique you can use to create tests for automated acceptance testing during Continuous Testing. With BDD-based tests running during your Continuous Integration process, you can give stakeholders fast feedback on whether the functionality is actually implemented and working–in terms that they can easily understand.
BDD Tools
Popular development testing tools for creating and managing BDD tests are:
- SpecFlow: .NET framework
- Cucumber: Ruby framework
- Gauge: JavaScript, C#, Java, Python, Ruby framework
- Tricentis Tosca: Scriptless testing framework for APIs and GUIs
- Jasmine: JavaScript testing framework
- Tricentis qTest Scenario: Jira BDD plugin
- Behat: Php framework
- Concordion: Java framework
- Squish GUI Tester: BDD GUI testing tool for JavScript, Python, Perl, Ruby, and Tcl)
BDD Resources
- Agile Testing Wiki BDD page: Explains the origins and pitfalls of BDD.
- Introducing BDD: Dan North’s classic article on BDD.
- BDD in DevOps: An example of the BDD workflow using tools in a continuous integration environment.
- BDD Kickstart: Papers, blogs, and other options for learning behavior-driven development with Cucumber.
- BDD Goes Enterprise: A webinar on why BDD fails in enterprise environments, and what’s needed to make it work.
- Getting Started with BDD: Answers to the most common questions about BDD and SpecFlow
- BDD Glossary: The most common BDD terms, their definitions, and examples.
- BDD, SpecFlow and The SpecFlow Ecosystem: Bas Dijkstra’s 5-chapter tutorial on how to get started with using SpecFlow in your test automation project