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 allow you to get end-to-end coverage for your user stories. PractiTest has you covered, from requirements, then connected to relevant tests and runs, followed by issues reporting (in case such arises) and all the way to reporting results via real time updating dashboards.

By combining manual, automation and exploratory testing within PractiTest, you get a comprehensive picture of your testing status. Ensure that you are providing your stakeholders the right information at the right time, so they can make smarter project and product decisions. We’ll proceed to walk you through the process while giving some BDD test examples.

practitest test management solution

ALL-IN-ONE TEST MANAGEMENT SOLUTION

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]

Your requirement for any scenario should be written in BDD common phrasing: “Given – When – Then”. In this example we display a simple “Login” scenario with a full description in BDD format –
new requirement BDD

Creating and Running BDD Tests

The next step in our BDD test case 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 created will be linked to the requirement throughout PractiTest, which will make tracking the user story status clear, simple and reportable. The new Test just created will have the same title and full description as it’s originating Requirement.

The next phase is to add the test steps.

When testing using BDD methodology with PractiTest, it is best to define the first step “STEP 1” as your “sunny day scenario” – your primary scenario to be tested. And then you can subsequently use the following steps (2, 3, 4, etc.) to test alternative scenarios based on the primary scenario. Be sure to mention the title of the scenario, add full expected results,and save your work.

Test steps in PractiTest BDD test

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

In the Test Instance window, mark the Pass/Fail etc. for each step. In this example the last step on my test, scenario 4 has failed. I can update the actual results description for further handling and documentation.

The status of my 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”).

Last bdd test step failed

Exporting and Viewing Results

The Test results can be exported in the Reports section and you can also create a useful Dashboard representation of your BDD Testing Results.
[Read more about PractiTest Dashboards]

practitest dashboard

 

Free Trial

14 day free trial, no CC required