Behavior Driven Development (BDD) framework is a software development process that is an offshoot of Test Driven Development (TDD) framework. BDD is an agile testing methodology. It is the process of development, based on test-driven development and domain-driven, object-oriented analysis. However, it can be organized with traditional testing as well.
Understanding Behavior Driven Development
While there will always be some gaps in meeting expectations between what a stakeholder wants and what is delivered, it is important to narrow down this gap as much as possible. One way to achieve this would be for the development and business teams to collaborate on a common language and have a suite of automated tests that when run, does what the stakeholder wants. These are hence called acceptance tests because the stakeholder finds them acceptable.
However, invariably, automated tests fail at the time of writing because no source code (and hence the AUT) exists, however it brings the stakeholders and developers on the same page about `what’ has to be done [Acceptance tests capture the behavior of the application as seen from outside i.e. as a user/stakeholder experiences it. This is different from unit tests, that capture whether you build the thing right, not necessarily build the right thing]. It is to resolve these kinds of problems that BDD exists.
Advantages of BDD and BDT
Co-ordinates between shareholders and delivery teams with different views on the same page but have a common expectation. BDD begins with the business goal.
The goal of BDT is a business readable and domain-specific language that allows you to describe the behavior of a system without putting details on how that behavior is developed.
In BDT, tests in the form of simple text descriptions/features with scenarios are typically written before anything else and checked by the non-technical shareholders.
Cucumber is an optimized tool for BDD, which can execute simple-text/Normal English functional specifications as automated tests. Cucumber supports writing specifications in around 30 spoken languages.
Cucumber starts with Ruby and then later Cucumber works with Java, .NET, Flex or web applications written in any language. It is both BDD and TDD. Cucumber establishes specifications in different ways like lists, prose, and data in tables.
Behavior Driven Script Development
Looks at the system from the outside and outlines the behavior.
Cooperates and comes up with a good and clear set of Acceptance Criteria.
Defined by a language called Gherkin Keywords
Feature: List of scenarios.
Scenario: Business rule through list of steps with arguments.
Given: Some precondition step
When: Some key actions
Then: To observe outcomes or validation
And,But: To enumerate more Given,When,Then steps
Scenario Outline: List of steps for data-driven as an Examples and <placeholder>
Examples: Container for a table
Most business clients prefer scrum product development. Originally, test automation has not matched the level of success in the developmental phases. This is the result of inappropriate perceptions of the effort and resources necessary to implement a successful, long-lasting automation framework development. Using the BDT framework, we should focus our automation framework to deal with the common components that make up our original automation framework that can be useful in easy development of test cases as such as Manual tester can do with Library keywords.
Calabash + Cucumber
Nowadays, Calabash Open Source mobile automation testing tool is growing popular and drawing attention in the market due to its automation capabilities for native & Hybrid Android & iOS apps. Users can write tests or features on top of the BDT framework with the help of Cucumber.
Disadvantages of BDD
We cannot just start building features before we have actually articulated how we expect people/shareholders to use them, what purpose they are meant to serve, and what value they are intended to help us deliver.
Technical and non-technical people/shareholders are forced to talk to each other and even work together closely to articulate features.
Enterprises have a tendency to turn BDD into some horrific version of end-to-end regression testing.
To know more, please visit: https://cucumber.io/