Managing your BDD requirements using Spira will allow you to get end-to-end coverage for your user stories, starting from requirements, connecting them to relevant tests and runs, reporting issues in case such arises and reporting results via real time updating dashboards.

Combining acceptance, automation and exploratory testing within Spira will enable you to get a comprehensive picture of your testing status and ensure that you are providing your stakeholders the right information.

Writing BDD User Stories

BDD specifies that business analysts and developers should collaborate in this area and should specify behavior in terms of user stories, which are each explicitly written down in a dedicated document.  Each user story should, in some way, follow the following structure:

Title

An explicit title.

Narrative

A short introductory section with the following structure:

  • As a: the person or role who will benefit from the feature;
  • I want: the feature;
  • so that: the benefit or value of the feature.

Acceptance criteria

A description of each specific scenario of the narrative with the following structure:

  • Given: the initial context at the beginning of the scenario, in one or more clauses;
  • when: the event that triggers the scenario;
  • then: the expected outcome, in one or more clauses.

Modelling BDD Tests in Spira

Within Spira, you will break down the BDD specification into two separate linked artifacts:

  1. The Narrative becomes a Spira requirement / user story
  2. The Acceptance Criteria becomes an acceptance test case in Spira

The BDD Specification Narrative

Spira has built in support for rich text artifacts, so you will create a new requirement and write the narrative directly in the system:

Then you use the built in SpiraTest feature Create Test Case from Requirement to create a new Acceptance Test from this requirement:

This Acceptance test will then have the BDD narrative already included. Now you can add the acceptance criteria steps to the test case.

The BDD Acceptance Test

By default, the acceptance test created automatically by Spira will include the title and narrative from the original user story:

You can now use the Test Steps section to add the various BDD scenarios. We recommend the following:

  1. Use the first step (Step 1) to be the 'happy path' primary scenario
  2. Use the subsequent steps for the alternate scenarios

For example, you might have:

Then when you go back to the User Story and look at the Test Coverage tab, you will see:

Your User Story is now linked to an Acceptance test that contains the different scenarios.

Automating the Test Case

Now that you have defined your BDD specification and acceptance test, you will want to automate the test using a tool such as Cucumber, jBehave, Jasmine, or SpecFlow.

SpiraTest lets you create additional test cases linked to this requirement and then automate them using the appropriate technology:

For more details on using these automated testing frameworks, please refer to the following KB articles: