Behavior-driven development tests enable collaboration between developers, QA, and customer representatives in a software project. By encouraging teams to use structured terminology and concrete examples, they can construct and maintain a common understanding of how the application should behave.

In the test library, Press ‘New Test’ and then choose BDD: BDD test

This test type has an extra field called “Scenario”. You can use the following Gherkin words in this field: Scenario:
Given
And
But
when
Then
*

In order for it to be recognized as a Gherkin keyword, each keyword should be entered at the beginning of a row. You can add as many rows as you would like.

For Scenario Outline, you can use the following Gherkin syntax (also at the beginning of each row): Scenario Outline:
Given
And
But
when
Then
*
Examples:

When used correctly (like in the examples here), PractiTest will recognize the syntax: BDD scenario outline

You can add as many steps and example rows as you like. The name you give the Scenario/Scenario Outline will be the name of the entire test and vice versa.

You can also import a BDD test with a Scenario field using the import functionality

BDD tests have the same structure and functionalities as other tests such as traceability, fields, history, etc.
All BDD test data including the test scenario field and steps’ results can be used in dashboards and reports.

Please note!

  • Unlike other test types, when a BDD test is edited, test instances that were added to test sets prior to this edit will not be changed accordingly.
  • Find and Replace is currently not supported for the Scenario field.

Run a BDD Test

In order to run a BDD test, add it to a test set. If you add a simple ‘Scenario’ type BDD test, the test will be added as an instance just like any other test.
If you add a ‘Scenario Outline’ type BDD test, PractiTest will automatically create multiple instances for each Example row in the Scenario Outline. The examples will appear as parameters in the parameters column of the instances grid. Unlike parameters, the examples cannot be edited from the test set and the value is static according to the examples in the test.

BDD instance grid

When you run the instance, each row in the original test will become a step in the test run, and the Gherkin word that starts the row will appear as the step name: BDD run

Like manual tests, you can add results and attachments, set a status, report or link an issue for each step. Unlike manual tests, the test cannot be edited from the run and actions are not available.

Report automated BDD tests’ results to PractiTest

Use PractiTest REST API to create or update BDD tests and their Test Set run's results in PractiTest.