Gherkin syntax support

Write scenarios in Gherkin language wisely with autocompletion, introspection through advanced steps database Gherkin editor in the test management app.

Gherkin language support by Test Management App

This test management solution supports Behaviour-Driven Development (BDD) process considerably. BDD is a contemporary, popular software development methodology that helps Agile teams build quality software fast by initiating collaboration across different team roles and spreading a common understanding of the problems to be solved.

Typically, BDD process involves such Agile roles as:

  • QAs
  • Dev team
  • BA (business analysts)
  • PM (project managers) or PO (product owners) roles

BDD scenarios are described in a special BDD language called Gherkin. Gherkin language serves two purposes: serving as project documentation and a pre-code for automated tests. Gherkin syntax is human-readable, so a non-tech person who doesn’t know any programming language can also write or maintain the behavior tests written with gherkin scripts perfectly. This is a key value of the Behaviour Driven Development approach!

What namely gherkin test scenarios outline

BDD scenarios logically focus on illustrating business rules – user stories as a goal and user acceptance criteria are what should be done to solve a problem or achieve this goal. BDD scenarios display end-to-end user interactions in other words each scenario outlines completed use cases within specific context details, named scenario steps.

Note, the feature file is the main entry point of the BDD scenario context according to the testomat.io test management app architecture. Gherkin feature file conventionally should consists of a single feature.

Gherkin language is a line-oriented language, like the YAML programming language. As mentioned before Gherkin Scripts connects the human concept of cause and effect to the software concept of input/process and output. Lines in Gherkin test scenarios start with a special keyword: Scenario, Given (initial condition), When, Then, And, But etc. Gherkin syntax uses indentation to define its structure and either spaces or tabs may be used for indentation. Line endings terminate statements (called steps).

What is the difference between Cucumber and gherkin language?

Gherkin is just a plain text language, Cucumber is a tool that is able to interpret and execute the test scripts written in Gherkin. For example, another testing framework that can interpret Gherkin – Behave. Behave is behaviour driven development tool for Python. RSpec position as BDD for Ruby.

What is test management Gherkin syntax support based on?

The Gherkin syntax support feature makes writing BDD scripts in the test management system possible thanks to the Advanced Gherkin editor.  Gherkin editor supports standard Gherkin scenarios in English. But we are exploring the support of other Gherkin localization in the near future. You may create BDD test cases with the Intelligent auto-completion service based on Database step definitions. Gherkin editor parser automatically analyzes and divides the input into Features, Scenarios and steps:

  • Feature: it’s a feature name, the name of the functionality we are describing;
  • Rule: a business rule that requires implementation;
  • Scenario: defines behavior of the user scenarios and consists of several steps;
  • Given (initial context condition), When, Then, And, But: Gherkin keywords used in writing the steps;
  • Background: Given steps that are repeated in each scenario;
  • Scenario Outline, or Scenario Template: scenarios with the same set of steps but with different parameters.

Let’s see how it works when we write BDD script manually:

  1. To start working on a BDD scenario, you need to create a new project in the test management system. Next, outline a scenario where tests will be placed in means of the Feature file.
  2. In the window that opens, select File, and then a button Edit Feature File – create tests by editing this suite in Gherkin format will appear. Clicking this button will open a blank field where you can start writing the BDD script.
  3. As we write, we will see that all keywords specific to the Gherkin language are highlighted in blue. The Gherkin editor recognizes them and remembers the information. This way, a database is formed, which will help write test steps – the autocomplete function is available to system users.

A significant advantage that sets our test management tool apart from competitors’ solutions – is its ability to automate Behavior-Driven Development (BDD) tests, enabling the seamless transformation of Gherkin language feature descriptions into automated BDD scripts. For this purpose, our tool boasts a wide feature set for automated testing, compatible with the most modern testing framework. And it is not limited only by the Cucumber framework; we offer compatibility with other combinations such as Playwright + BDD, Cypress + BDD, and Codecept + BDD.

What happens when we import automated BDD tests:

Thanks to the built-in analysis of the test management application, BDD tests synchronize during the import of automated tests. All BDD steps are added into Steps Database from your code. After then, you are free to re-use them by creating new test cases with the original auto-completion BDD support feature.

Gherkin keywords are highlighted in automated tests as well. Moreover, the Gherkin editor analyzes immediately every Gherkin keyword which is used in the code of the testing BDD framework. You are able to format BDD scenarios to the pretty view with one click – the test management system aligns all lines and makes the feature file easy to read. All previous versions of the script are also available in the History tab of the menu dashboard. Edit the Feature file if you need.

Other test management BDD support functionality

  • Import by testing frameworks – powers import BDD test scripts from Cucumber, CodeceptJS, Cypress.io, Playwright testing frameworks and visual presentation them through test result Reporting and rich Analytics.
  • Migrate from TMS and convert to BDD – test management supports importing your test cases from qTest, Zephyr or TestRail based on a CSV/XLS file. You can directly import all your BDD test suites into BDD format and successfully continue work with existing BDD projects.
  • BDD test case creation – Gherkin language support works both at the test level (you can create your own test cases) and at the level of a particular script. That is, if you need to describe an individual behavior scenario in more detail, the test management system will recognize keywords and understand that it is Gherkin parameters.
  • Living Documentation – allows us to get up-to-date test data, which means all changes made in tests are displayed in Living Docs in real-time. Also, collaborate with all team members using this feature – the information is presented in an easy-to-read format that even tech specialists can catch.
  • Jira BDD – by installing the Advanced Jira extension, you can link test cases created in the test management system to the user story requirements in Atlassian Jira. This allows you to create, view, and modify BDD tests in the project management system and vice versa – all changes made in the test web solution will show up directly in Jira plugin with the same BDD editor.