If you are a tester I’m sure you have heard about BDD, but what is Bdd Testing, and why it is important for the business? Well, BDD is an extension of the TDD(Test Driven Development) framework, which is a methodology that promotes writing unit tests before actually coding.
What is BDD testing?
BDD stands for Behaviour-Driven Testing and means that we are going to change the way we think and design our tests, focusing more on the behaviour and the business side of the product.
BDD Testing Framework
BDD is an agile process used in software development that promotes collaboration between different parties inside the companies. For instance, we can involve product owners, testers and developers in the requirements definition and use that as a starting point for software development.
When using BDD, we use natural language (plain English for example) to define the expected behaviour of our application.
BDD vs TDD
BDD is an evolution of TDD that allows us to focus more on functional tests that help us to validate not only the application under tests from the technology point of view but also from the business perspective.
In other words, TDD has more focus on unit tests and BDD has more focus on functional tests.
BDD Examples
For BDD we are going to use a language named Gherkins, that uses plain English as a base and allows us to define the application behaviour based on certain conventions;
Let’s say that we are creating an application for an online store and one of the requirements is that the store must accept product returns, we can define that using gherkins like this:
Title: Product return As a store employee I must be able to accept returns and modify the inventory Scenario 1: Returned articles should be added to the inventory Given a client that has bought a computer from the store And the store has N computers in the inventory When the costumer returns the computer Then the inventory should display N+1 computers
As you can see in the above example, we have certain elements that we can highlight in the Gherkins format:
- Title
- Narrative
- Acceptance Criteria
Each one of the elements represents a convention that every party involved in the definition can use as the acceptance criteria, for example, a product owner can write the definition in the above example, a developer can use it for developing the functionality and a tester to write the acceptance criteria for the user story.
When we should use BDD?
As we can see the BDD development allows us to use plain english to define the behaviour of a software application, bringing us the possibility of using that language as a base to write our code in a transparent way for product owners, bussiness analysts, teters and developers, among others.
BDD in autmation testing
BDD can be used in automation testing so if you are already working on test automation or want to learn selenium webdriver, you can implement BDD in your project. For this purpose, there are different libraries such as cucumber that allows us to easily implement BDD in our code.
The post What is BDD Testing? appeared first on Relevant Codes.
This post first appeared on Relevant Codes — A Blog By Anshoo Arora Featuring Articles On Test Automation Tools, Frameworks And Code-design., please read the originial post: here