Testing Made Fun - How BDD Tests Can Help You Sleep at Night

By Adrianna Gregorczuk

Hi, I'm Ada and my day-to-day job at Aexol is providing comprehensive support for technology projects. I am incredibly pleased that over the past months we have taken a close look at our company's processes and tried to gain a better understanding in the area of testing technology products and services. It has been an incredibly interesting journey, from which we have drawn important conclusions and created a testing tool that is practical yet simple to use even for beginners in IT.

Everyone has their preferred way of doing things, but in the field of software development, you're likely to encounter some standards for how your organization handles each stage of the software development process. this is because taking a systematic approach to this lifecycle can be quite advantageous.

Expanding the dialogue and keeping diverse teams on the same level guarantees smooth delivery of software. In addition, as IT companies are moving forward, they must adjust their procedures to meet the needs of their currently existing flows.

Let's start by taking a look at the field of testing. It's becoming more and more apparent how it's essential for teams wanting to deliver innovative and high quality software and apps.

What exactly is BDD (Behavior-Driven Development)?

You may have recently heard about Behavior-Driven Development, or BDD. BDD is an continuation of Test-Driven Development (TDD) which focuses on creating products based on a user story and producing code that solves real-world problems.

As a result, the customer or product manager oversees the realization of a vision, and the developer then determines the behaviors required to accomplish the stated business goals. Then the tester is brought in to see if the newly implemented functions match the reasoning behind the code.

For instance, lets say a product owner or client says that in their study, they discovered that their app has a significant number of older users and they need a way to make it easier for them to use. Your next move as a BDD developer would be to consider how this affects features you would like to add to the application - perhaps they should have larger and more easily clickable components.

Obviously, determining all the different user behaviors significant for the application is an important aspect of BDD, which necessitates maintaining an open dialogue with important stakeholders in order to appropriately identify the right improvements or changes and where and when they are needed.

BDD emphasizes teamwork and multidisciplinary workflows. This guarantees that these user stories and behaviors are properly conveyed from the company's side to the technical delivery team - as this is an essential element of successful Behavior-Driven Development.

Following a BDD approach

BDD, like TDD, encourages that tests really should be developed before anything else which is beneficial for high test coverage. Because BDD involves the collection of validation tests, teams that rely on it frequently use test automation as well as Continuous Integration and Continuous Delivery solutions.

While the myth of test automation replacing testers continues to exist, the BDD approach emphasizes the significance of testers in the the Software Development Life Cycle. Testers aren't need only to simply verify that the code works, but they additionally have to analyze the problems it claims to solve.

Consequently, BDD testing involves both - the operational aspects of the features and the initially proposed behaviors for which they are being developed. Instead of just determining if a features works, testers must consider the overall perspective and the scenarios in which it is employed.

BDDX

BDDX is an open tool for developers and testers based on BDD. We should mention, it reached a lot of new users in its initial weeks, indicating that it is a popular choice in the community.

It uses Cucumber's Gherkin language, which allows contributors to describe application behavior in plain and easily understandable language, that can also be used to communicate with software stakeholders about how the application is expected to behave and respond, what behavior has driven what, and why.

While the Gherkin language relies on the application's code, it may be read and understood by anyone. The goal of this is to clarify various steps in the development process to all the members of the team participating in the software's release.

This adds an additional dimension of complexity that communicates the advantage of new features to the customer in a way that tells them whether or not it fulfills the initial goal and provides a simple answer to business challenges.

By holding an open and knowledge based dialogue as the application progresses through the SDLC, everyone can take part and easily determine where something went wrong and identify which aspects or elements may need to be modified or fixed.

How to map user stories using BDD

Let's see an example of how BDD works in practice. Let's say that the new feature will be for an e-commerce store (could be on Shopify) and it will be a "Add to Favorites" functionality.

Our three best buddies (project coordinator, dedicated developer, and tester) talk about what that feature really is and how it will behave in various scenarios. They will use many examples to determine how the feature will act in each instance. These examples will serve as scenarios for the feature's development (as well as testing). They're probably going to write down a number of somewhat different scenarios - which are the examples - once they reach an understanding about each case.

They will first decide on the required conditions and add-ons for the actual system. For example, in order to implement the "Add to Favorite" feature, they must meet this set of requirements:

  1. The customer has logged into their web store account.

that is our example's Given statement:

Given customer has logged into their web store account.
  1. The customer adds a product to their “Favorites” list.

this can be written using the When statement as follows:

When customer clicks on “heart” icon to “Add to Favorites” product is added to their specific account list “Fav”
  1. The team determines and outlines the action's results

which can be written with Then:

Then customer should see their specific account list “Fav” updated with the product name.
And the product “Fav” quantity should be higher by one position.

As you can see, the keyword And serves a purpose in the Then example. When there are more stages for a specific type (Given, When, or Then), the term And is used instead of:

Then customer should notice that the shopping cart has been updated with the product name.
Then product “Fav” list count should increase - one.

Ok, let’s go with another example to add a little bit more visual context to what we are talking about:

Story: Transfers for best friends change balance <3
As a bank application user
In order to send money to somebody
I want my bank wallet balance to update after the transfer
Given that I have $1000 in my balance
And my best friend has $50 in their balance
When I transfer $10 to my friend
Then I should have $990 in my balance
And my friend should have $60 in their balance.
:)

The Fundamental Concepts of BDD

This is very significant for fully comprehending BDD. Visit the website bddtests.com to learn more about BDD and automated testing.

If you've been hearing about the pros of BDD from your friends or coworkers but aren't sure where to begin working on delivering practical things back to your business, BDDX is absolutely the right tool for you.

In any case, our Head of BDD Marcin Dadura will help you evaluate where you and your team are in the industry, as well as how you can use the most effective elements of the BDD process to optimize the way you do things - so feel free to reach out!

author

Adrianna Gregorczuk

Business & Growth 🚀

I foster agile ways of thinking and working, create an environment where teams can do their best work, and champion agile throughout the AEXOL organization.

Could use some help with Tech?

author

Adrianna Gregorczuk

Business & Growth 🚀

I foster agile ways of thinking and working, create an environment where teams can do their best work, and champion agile throughout the AEXOL organization.

Could use some help with Tech?

Next Article

How to create a React Native typography system

Read article
Next Article

How to create a React Native typography system

Read article
Share
Fast Landing Pages
Plugins
Let's start working together!
What we can do
Let's start working together!