February 24th, 2021 by inflectra
We are excited about the next release of Spira 6.8, due to be released in March. As we described in a recent blog post, this new version includes major enhancements to the documents management module to allow users the create and edit inline content directly in Spira. However this new feature also makes it amazing easy to write BDD style requirements and test cases in Spira using Gherkin syntax with automatic syntax highlighting. Intrigued, well read on...
Behavior-Driven Development (BDD) is an Agile software development process that encourages collaboration among developers, QA and non-technical or business participants in a software project. It encourages teams to use conversation and concrete examples to formalize a shared understanding of how the application should behave. A Sample BDD requirement would be:
An explicit title.
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.
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.
Gherkin is a business readable language which helps you to describe business behavior without going into details of implementation. It is a domain specific language for defining tests in a standardized format for specifications. It uses plain language to describe use cases and allows users to remove logic details from behavior tests.
In addition to being a useful way of describing a requirement specification, the text in the Gherkin language acts as both documentation and the skeleton of your automated tests. The Gherkin format is based on TreeTop Grammar which exists in 37+ languages. Therefore you can write your a Gherkin test in 37+ different spoken languages.
An example BDD requirement specification written in Gherkin would be:
Feature: Login functionality of social networking site Facebook. Given: I am a facebook user. When: I enter username as username. And I enter the password as the password Then I should be redirected to the home page of facebook
The new inline document authoring and editing feature in Spira lets you write Gherkin .feature files as well as rich text and markdown documents:
When you choose the option to add a new Feature file, you enter in the filename, description, document type and any associated tags:
Once the blank document has been created, you can now write your Gherkin feature file directly inside Spira:
When you click Save you can use the View tab to see the feature file with the syntax highlighted:
If you make any changes to the feature file, Spira will automatically track the versions for you:
Once you are done, you can now link this Gherkin feature file to your choice of requirement or test case in Spira:
Now that you can write and edit Gherkin feature files directly inside Spira, our plans are to make these files available to our Rapise test automation platform to enable streamlined automated testing...