In continuously evolving IT world, we are introduced to new technology and new approaches to learning every day. These new technologies and approaches make life easy and create a better life for developers, Tester, Business Analyst etc. Behaviour Driven Development is the result of change and innovation in the IT world. Let’s learn about BDD today,
Behaviour Driven Development (BDD) is a software development approach which is evolved from the Test Driven Development (TDD) approach. In Test Driven Development, the test cases are written mainly on technical language. This covers unit test cases. It is ok to have if your Business Analyst or Business owners know about the unit test language. In general, the Business owners or Business Analysts have limited knowledge of technical terms and languages. To keep all on at the same page, BDD approach evolved.
Behavior Driven Development :
It is an approach which brings the BA, Developers and Tester (i.e tech and non-tech team) together. The simple English language is used to write test cases. This is more user-focused and as per the system behaviour. Due to the direct involvement of the business owner or BA, the functionality coverage is more, which improves the product quality.
A particular pattern and keywords are used while writing BDD. Below are the key things in the about the BDD,
- Written in simple English language.
- Particular keywords like Given, When, Then should be used.
- Understanding the system behaviours and functionalities.
- Driven by Business behaviours.
- Collaboration between Business stakeholders, BA, QA and developers.
The file on which the all the BDD test cases are written is called Feature file. We save file with “.feature” extension.
Keywords :
Feature : It comes on the top of the feature file. It tells about the feature file title and description of the functionality you are going to cover. Below is the feature example. Here, we are trying to login functionality of a website.
Scenario: It tells about the test case name or title. We write about what are we going archive from the test case. A function or behaviour is split into small test case or scenario. Below are the examples of scenario.
Given : It tells about the pre-requisites required to test that test case. All the pre-requisite steps or data will be written with Given. We can have more than Given in a scenario. Below is the example,
And : It works a repeater. It follows the keyword used before it. If it follows Given , all the And keywords will be replaced with Given and those steps are pre-requisite till it finds when or Then. Examples are,
this above one can be written,
When: It is used to describe the action of the test case. It means the final activity which produces the result. It always suggested having one When in a scenario, that gives a clear view of that test case. if you keep multiple when it creates confusion, which is the action produced a result.
Then : All the validation are done in the Then section. We can have multiple Then statements.
Above statements can be written as below,
Disadvantage :
- It is not suitable for the waterfall model.
- If you don’t have enough knowledge of the system, BDD can be messy.
Summary:
BDD is an interesting approach to adopt. It is mainly suitable for the AGILE methodology. You can try some real time scenario and learn more about BDD.
Thanks for reading. Please let me know your valuable suggestion and comments.