As a natural extension of Test Driven Development (TDD), BDD takes things a stage further.
TDD focuses on the use of Unit Tests to drive out a specification for your code and to guide your development. The nature of unit tests means that they are mainly practical for use by developers and, as the name suggests, only for unit testing.
Among other things BDD answers the following questions:
- How can we bring non-developers into the specification process?
- How can we bring the benefits of a TDD/BDD model to functional testing?
In BDD we describe testing scenarios in the Gherkin language, which looks a lot more like normal english than unit test code. Those test scenarios are then used to automatically build ‘step definitions’, which is the scaffolding code for our testing. We can then use unit test code within that framework to guide our development.
(credit: Tao of BDD)
We can also use the step definitions to drive a web scripting and run things like Selenium WebDriver or CasperJS.
Part 2 coming soon.