In this article we will learn, what is Behavior Driven Development framework and Cucumber from beginner to advance level.
BDD : Behavior-driven development is a software development process which is extension of TDD(Test Driven Development)
(in TDD we just write our code we write the test cases and run test cases & report the failed cases to get fix.)
It is used to test the system rather than testing the particular piece of code.
1).BDD focuses on behavior and not tests.
2).BDD defines application behavior using simple English text, defined by a language called Gherkin.
3). BDD focus on what to test not how to test.
4).Behavior Driven Development gives us an opportunity to create test scripts from both the developer's and customer's prospective as well.
Features of BDD :
0). Extends Test Driven Development(TDD) by utilizing natural language that non technical stakeholder can understand.
1). Shifting from thinking in "tests" to thinking in "behaviour"
2). Common language, it is easy to describe.
3). Collaboration between business stakeholder, Business Analysts, QA Team and develops.
4). Driven by Business value.
Introduction of Cucumber :
What is Cucumber :
Cucumber is a testing framework which supports Behavior Driven Development(BDD). It lets us define application behavior in plain meaningful English text using a simple grammar defined by a language called Gherkins.
Feature file :
The file, in which Cucumber tests are written, is known as feature files.
The extension of the feature file needs to be ".feature".
One can create as many feature files as needed. To have an organized structure, each feature should have one feature file.
For Example : user-login.feature
A feature file is an entry point to the Cucumber tests. This is a file where you will describe your tests in Descriptive language(Like English). It is an essential part of Cucumber, as it serves as an automation test script as well as live documents. A feature file can contains a scenario or can contain many scenarios in a single feature file.