Ever stood in a Sprint demonstration and the product owner said “That’s not what I wanted”? This is a common problem in software projects, in fact one of the biggest source of bugs and unnecessary rework. Most people wrongly associate BDD with Test Automation, but it if applied correctly it can also solve the “That’s not what I wanted” problem by building a shared understanding of the User Story between the product owner, developers and testers.
Building a shared understanding of a user story
Understanding Users Stories and Issues is tricky, each team member interprets them differently leading to the wrong thing being built. BDD solves this by getting the three amigos (Product Owner, Developer and Tester) to discuss examples of how they expect the software to behave in different situations. By using examples team members can discuss them until everyone stops asking questions and is happy, this is when the shared understanding is reached.
Behave Pro allows you to capture these examples as scenarios directly on Issues/Stories within JIRA. It does this by adding a new panel Acceptance Criteria to Issues within JIRA and with a powerful editor supporting Gherkin (Given When Then format)
Adding a new Scenario is simple, click Add scenario and fill in the details:
- Feature - The name of the feature this scenarios belong to. Note: If you need a new feature just type in the name you want and the option to create it will appear
- Scenario - The title or name of the Scenario you are creating
- Steps - The Given When When And But steps that make up the scenario/example. The full range of Gherkin keywords are supported, including Examples tables. The powerful editor also supports auto completion of steps and table formatting.
Once you've created the Scenario you will be able to see three additional items for the Scenario: Testing method/type (Automated or Manual), Tags (represented by the tag icon), and Trash-can icon to delete the scenario.
Why do I need to specify a Feature when creating a Scenario?
A User Story represents a small piece of functionality that's needed at a given moment in time, it doesn't represent a whole feature within a Software project. When a Story is implemented it is no longer required but we want to keep the Scenarios we spent time refining. A whole feature is made up by implementing many user stories over a period of time, so if we specify that scenario belongs to a feature as well as a Issue/Story we won't lose the Scenarios when an Issues is 'done'.
You can work with Features and Scenarios directly instead of on Stories/Issues by using the Specifications page. This page allows you view your project from the Feature point of view and organise your Scenarios into living documentation.
Exporting Features and Scenarios to Cucumber and other test automation tools
Now you have your User Stories refined using Scenarios, and the Scenarios have been organized into documentation using Features, you can use tools BDD automation tools like Cucumber to turn the Scenarios into automated tests to help check the software under development.
Note: If you are just writing Given When Then just for Test automation purposes you are not really doing BDD. You might benefit switching away from a BDD automation tool to a Test Automation tool
The Gherkin family of automation tools, Cucumber, Cucumber-JVM, Cucumber-JS, SpecFlow (C#/.net), Behat (php) and Behave (Python), all consume plain text feature files in the Gherkin format. Behave Pro can export these gherkin files on a per feature basis and for a whole JIRA project.
You can integrate one of Behave Pro's build tools into your projects build process to export all the feature files for your project to a local directory before executing Cucumber or your preferred automation tool of choice. Available build tools are Maven, Gradle, MSBuild (C#/.net), Rake, NodeJS, Python and command line clients in Ruby and Python. Check out each tools documentation to understand how to configure them.
Because building the shared understanding about the User Story is so important you want to look into Behave Pro's "Questions and Ready" feature that allow's team members to 'vote' their understanding of stories/issues.