{"id":94,"date":"2019-07-08T14:39:25","date_gmt":"2019-07-08T14:39:25","guid":{"rendered":"https:\/\/www.bddtesting.com\/?page_id=94"},"modified":"2019-07-08T14:39:25","modified_gmt":"2019-07-08T14:39:25","slug":"how-and-why-to-adopt-bdd-in-software-development","status":"publish","type":"page","link":"https:\/\/www.bddtesting.com\/how-and-why-to-adopt-bdd-in-software-development\/","title":{"rendered":"How and Why to Adopt BDD in Software Development"},"content":{"rendered":"\n
Behavior-driven development (BDD) addresses the problem of implementing poorly defined requirements by leveraging the domain expertise of business and QA professionals to ensure that the development team builds the correct software. Read on to learn more about how to adopt BDD in the enterprise.<\/h5>\n\n\n\n

Over the past several years, many organizations have transitioned to agile development<\/strong> in order to accelerate delivery and get more timely feedback from the market. In these organizations, while development begins to move faster, QA will struggle to keep pace unless they integrate automated software testing practices into the development pipeline, so that is often the first bottleneck to overcome.<\/p>\n\n\n\n

But after successful adoption of test automation and the whole organization moving more quickly, organizations start to ask themselves if they are building the right<\/em> software. Accelerating software development and ensuring software quality with automated continuous testing is a great achievement, but it\u2019s all for naught if the software isn\u2019t what your customers want or need.<\/p>\n\n\n\n

Folks at this stage in their software development processes evolution are taking a close look at BDD as a means of ensuring that their software meets their organization\u2019s business requirements. But what exactly is BDD and how does it pertain to testing?<\/p>\n\n\n\n

TDD vs. BDD<\/h4>\n\n\n\n

BDD is an evolution of the test-driven development (TDD) methodology<\/a>, in which developers write the test before<\/em>writing the code. After crafting a failing test to start, developers practicing TDD write just enough code to ensure that the test passes, then write another test; rinse and repeat. The result is lean and mean code with high test coverage. <\/p>\n\n\n\n

TDD is an activity designed to improve software quality and ensure code coverage. BDD, in contrast, solves the problem of correctly implementing requirements. Rather than focusing on the test<\/em> to verify the functionality<\/em> you want implement, BDD is about defining the behavior<\/em> of the application so that it meets specific business requirements<\/em>.<\/p>\n\n\n\n

The similarity between TDD and BDD is that a contractual mechanism is implemented before any work is done, to ensure that the output matches a specific expectation.<\/strong> But this is where the similarity ends. In TDD, the test is a contract intended to ensure that the application meets a specific functional requirement. In BDD, the behavior is the contract intended to ensure that the application meets a specific business requirement.<\/p>\n\n\n\n

What is BDD in Software Development?<\/h4>\n\n\n\n

We\u2019ve been casually throwing around the term \u201cbehavior,\u201d but it does have a technical meaning in the context of BDD. In BDD, behaviors<\/em> are carefully-crafted, human-readable statements that follow a specific format. They are collected in \u201cfeature files\u201d that can be integrated into the development process.<\/p>\n\n\n\n

Feature files are typically written in Gherkin, which is a BDD-specific syntax that enables BDD tools, such as Cucumber and SpecFlow, to automate the process of validating the behaviors. These BDD tools parse the behaviors in the feature file and execute the appropriate \u201cglue code.\u201d This glue code maps \u201cbehaviors\u201d to execution steps, typically Java or .NET test code written by a developer, in a specific test engine. These mappings are commonly referred to a \u2018step definitions,\u2019 or \u2018step-defs.\u2019 As a result, testers can use feature files as test cases that verify the behaviors associated with the requirements.  <\/p>\n\n\n\n

\"BDD<\/figure>\n\n\n\n

What are the Benefits of BDD?<\/h4>\n\n\n\n

There are several advantages that Business-Driven Development brings to software development. With BDD, you can:<\/p>\n\n\n\n