logo logo

BDD Basics For Beginners

BDD Basics For Beginners

One of the most popular terms in the quality assurance arena is BDD (behavior driven development), and there are many misconceptions about it. Lately, it has also been the most searched terms in software development. In this article about BDD basics for beginners, I will try to shed some light on BDD, its core principles, and some good practices.

What is BDD

BDD is a process, a mindset more than an automation tool or framework. In general, actual automation scripting starts when application build is available. Automation is done by testers or developers 👩‍💻 However, BDD is a process that is not limited to the automation of features but drives the entire software product development.

BDD makes things easy by converting requirements into executable specifications with simple realistic examples, and also ensures that every stakeholder is on the same page. Product features explained in BDD Gherkin syntax are easier to understand, implement and validate.

What BDD is not

There are many misconceptions about BDD. The first and most prominent one is that BDD is an automation tool or automation framework which helps automate test scenarios for applications under test. This is the biggest myth in respect of behavior driven development ❌

Advantages of BDD

There are many benefits when the team adheres to the basic principles of BDD. Below are a few important advantages:

  • It improves team collaboration by bridging the gap between technical & non-technical members.
  • It adds simplicity and clarity to the requirements.
  • It expressly defines distinctions between the application’s initial state, user actions, and expected outcomes in plain simple English.
  • It has the support of numerous tools which help automate or validate scenarios e.g., Cucumber (Java), JBehave (Java), Behave (Python), SpecFlow (C#). They are some of the popular libraries which support the behavior driven development process.
  • It supports JIRA test management tools which help in achieving traceability, tracking issues, etc.

Challenges in adopting BDD & steps for remediation

As said BDD is more than an automation tool. It is a mindset, a process, but most of the time, teams do not follow the BDD principles and treat it as another tool to automate test cases.

This is the biggest issue while adapting the BDD model 😥 It requires good training, awareness programs to make the team aware of BDD and its core principles. There are some set of rules or activities that can help in adapting BDD in a graceful manner:

Brainstorming workshop for the entire team 

This is very crucial to make the team aware of the BDD development model. A simple session wouldn’t help much, but an example-driven workshop to be conducted among the product manager, BA, Dev, QA might help understand the very essence of the BDD process.

Switching from traditional requirement drafting to Gherkin scenarios 

This requires effort to change the mindset of capturing abstract requirements in long paragraphs. Switching over to the behavior driven development process might take some time and a bit of hesitation among team members, but once the team starts following things in order, it will be beneficial in the long run 🥇

Discussion among team members and formulating the example-driven requirements will help the team to reach a common understanding. This is less time-consuming and simple to understand compared with the traditional approach.

Here requirements are captured in the Gherkin syntax using a set of keywords, but at the same time in simple plain English. This makes requirements easier to understand for stakeholders irrespective of their technical background – whether it’s business, product manager, BA, DEV, or QA. Below is a simple example:

Feature: User Login
As a valid user, I should be able to login to Gmail account

Scenario: I should be able to login Gmail account with valid credentials
Given I am on Gmail login page
And I entered the valid credentials
When I click on Login Button
Then I should be able to see my email Inbox

You can see the beauty of the above feature which is very clear & understandable 😃 It does not require any extra effort even for a non-technical team member and eventually makes the team clear on end-user expectations.

In addition, the Gherkin steps are nothing but executable specifications which can be easily automated with the help of an automation tool. They can also help in a quick validation of features.

Efficient requirement capturing

This is a very important part. The team should not be writing test cases, but rather should be capturing the end-user behavior. The scenario should resemble the end-to-end user flow and interaction.

The focus should be put on core functionalities rather than bits and pieces. More emphasis should be on how we can capture requirements in a more efficient way while keeping maintainability in mind.

Continuous review & feedback

This is the most important part while adapting BDD in the long run. For result-oriented and successful implementation, the team needs to meet regularly to review the current execution, and to take regular feedback for improvement. This will help to eradicate any loopholes or impediments, and make the process smoother 💪

Starter and a quick guide

This is a sample starter code that doesn’t cover the entire behavior driven development process, but can help beginners who want to validate product features with the help of BDD tools.  It includes some sample APIs as well as UI features.

Conclusion

In a nutshell, behavior driven development is more than an automation tool or framework, and the team will reap the benefits only if its core principles are followed. Team awareness & workshops play a major role in adapting this model. Using BDD for mere test automation is not the right way to achieve the main moto behind BDD.

Your thoughts, feedback, or suggestions are very much welcome. Happy reading! 📖

Santosh Chauhan

About the author

Santosh Chauhan

Santosh is associated with a FinTech firm and working as a SDET. He has over 11 years of experience in quality assurance, automation & analytics and is very passionate about process & quality.

LinkedIn

Join TestProject Community

Get full access to the world's first cloud-based, open source friendly testing community. Enjoy TestProject's end-to-end test automation Platform, Forum, Blog and Docs - All for FREE.

Join Us Now  

Leave a Reply

popup image

Take the simplicity of BDD to the next level

Cucumber, SpecFlow or Behave - we've got you covered! Run your BDD tests locally and automatically gain Gherkin-based test reports and living documentation on for your entire team via Analytics dashboards, PDF or RESTful formats.
Get Started
FacebookLinkedInTwitterEmail