Gherkin is the most commonly used syntax for describing examples with Given/When/Then in plain text files, called feature files. Gherkin scenarios can be automated to validate the expected behavior. At this point, BDD tools – such as SpecFlow – come in handy. Automated acceptance tests, however, are an optional by-product of using BDD, not the sole purpose.
Automated Gherkin scenarios are “green” when up-to-date and in sync with system behavior. Whenever the updated system stops producing the expected behavior, the affected scenario turns red to alert the team. This failure can be caused by new behavior that contradicts with previous requirements or the updates introducing unwanted side-effects. In any case, the team must fix this mismatch to make all scenarios green again. When the team follows this practice, Gherkin documentation grows with the system, providing an always up-to-date specification of its behavior. This is also called “Living Documentation”.
To summarize, Behavior Driven Development can be defined as follows:
BDD is an agile software engineering practice that supports feature discovery and encourages collaboration among developers, testers and business participants in a software development team. BDD is facilitated through examples expressed in natural-language constructs expressing the expected system behavior, and automation validating these examples as acceptance tests.