How to Test Behavior Driven Development (BDD) with PractiTest

Managing BDD scenarios with PractiTest

One of the oldest premises of QA, is that it is easier to develop a product right using a quality driven approach, than by fixing all the bugs at the end. This is where approaches such as BDD come into play. And with more and more companies shifting from waterfall to Agile or Agile-like approaches testing, quality have become a more integral element in all phases of the project and not just at the end of it.

What is BDD testing?

Behavior-driven development or BDD, which was first written by Dan North, is a method for a more accessible and effective way for teams new to agile software delivery that aims at testing human behavior rather than a computer function.

Test scenarios in BDD are based on the concept of “given, when, then” to describe various user BDD scenarios. Test cases written so, in simple text, help even non-technical team members to understand what is going on in the software project, with or without a test management tool. A common usage of the BDD approach is with automation using Gherkin and combining it with unit testing

Advantages of BDD test cases in software development

As pointed out before, BDD’s main advantage is that it increases and improves project collaboration and enables everyone involved to easily engage with the product development cycle.

But it also provides better coverage assurance, since the BDD scenarios are focused and defined around specific expected outcomes. This also contributes to far less ambiguity for developers.

Another advantage of the BDD framework is that it is easier to translate into automated tests, is very reusable and supportive of parameterization. For instance, “example tables” make it easy to run the same scenario with different combinations of inputs. BDD framework is also very adaptable, and can easily be modified as features are developed.

What BDD tests look like in PractiTest

Managing your BDD requirements using PractiTest will provide you with end-to-end coverage for your user stories. PractiTest has you covered, from requirements to relevant tests and runs, followed by issues reporting (in case such need arises) and all the way to reporting results via real-time dashboards.

Combining manual, automation, exploratory and BDD testing within PractiTest gives you a comprehensive picture of your testing status. Give your stakeholders the right information at the right time, so they can make smarter project and product decisions. We’ll walk you through the process while giving some BDD test examples.

PractiTest test management dashboard on computer screen
Manage All Your QA Efforts in One Place

BDD scenario examples from user stories in PractiTest

Because BDD testing is based on user stories, it is best to start in PractiTest Requirements’ module, where you can create and manage all your project requirements.
[see more on how to create Requirements]

Creating and running BDD tests

The next step in our BDD test example is to create a test for the requirement. To create a related test, go to the 'Traceability' tab in the new requirement and create a new test for the requirement. Notice that it is possible to connect the requirement with an existing test from the test library, as well.

The new test will be linked to the requirement throughout PractiTest, which will make tracking the user story status clear, simple and reportable. The new Test will have the same title and full description as its originating Requirement.

The next phase is to change the test type to BDD and add the scenario/scenario outline.

Use the following Gherkin words in the Scenario field:
Scenario: / Scenario Outline
Examples: (in case of Scenario Outline)

BDD test

BDD scenario outline

Once the test is ready add it to an existing Test Run (of course, a new Test Set can be created, as well) and proceed to Run.

If you used Scenario Outline with examples, the test will be added to the test set as multiple instances, an instance for each example row. You will be able to see the example used for each instance in the Parameters column in the instance grid and in the Test Instance window.

BDD instance grid

Press ‘Run’. In the run window, each Gherkin step used in the scenario/scenario outline field will be broken down to a separate step. Mark the Pass/Fail for each step and update the actual results description for further handling and documentation.

BDD run

The status of your Test can also be seen in the Test Library, as well. (Note: with PractiTest, if any one step is marked as “Fail”, the entire test status will be flagged as “Failed”).

Report automated BDD tests’ results to PractiTest

If you are using automation tools to run your BDD tests, you can use PractiTest REST API to update the tests results in PractiTest.

Exporting and Viewing Results

The Test results can be visualized in the Reports section. You can also create a useful Dashboard representation of your BDD Testing Results. The Scenario/Scenario Outline field in the test module will be available for dashboards and reports in a future update.
[Read more about PractiTest Dashboards]

practitest dashboard


Free Trial

14 day free trial, no CC required