BDD testing framework

In the BDD (behavior-driven development) testing framework, you create BDD specifications and scenarios. Test execution, automation, and backlog coverage are at the scenario level. The BDD spec gives a run result for each scenario in the feature file.

Overview: BDD and Gherkin test workflow

You can create and run BDD (behavior-driven development) tests using Gherkin scenarios. You create specifications to describe the scenarios you want to test, manage the automation effort, and track run results.

There are a number of workflows for working with BDD tests. The following is one example of working with BDD tests using Gherkin.

  1. A business persona creates a feature.

  2. Together with the testing team, they create acceptance tests for the feature in Gherkin.

  3. These tests can be run manually, or can be marked as ready for automation.

  4. When the developer sees which tests need automation, they take the contents of the feature file, namely of the Gherkin test or BDD spec, and save it locally in the IDE. They then automate the test and push the code to the SCM system.

  5. The automated tests are now run in the CI and results are reported.

  6. You can now see test results and coverage data in the context of the original feature.

Another common flow is when a tester creates a feature file in the code, and the test is injected from the CI. This test can then be assigned to a backlog item or application module.

  • You can inject test results from the common BDD frameworks, using the bdd2octane tool. For details, see Create and run BDD scenarios.

  • For Azure DevOps integrations: Use the CucumberReportPath parameter to configure the path from which the integration can take BDD test results, after they are processed by the bdd2octane tool. The path should be the output folder that contains the test results generated by the tool.

  • You can create BDD specifications and Gherkin tests in languages other than English. For details, see Localization.

Back to top

Advantages of the BDD testing framework

The BDD framework described in this section offers you the following:

  • You can run individual scenarios.

  • You can report on a scenario run level.

  • You can partially automate a specification to only run some of its scenarios.

  • You can link specific scenarios to specific backlog items.

For example, if you previously had a Gherkin test with 20 scenarios and only 19 of them passed, the test failed. In the BDD framework you can run 20 scenarios separately, and immediately identify a failed scenario.

You can also add specific scenarios to a suite, and do not need to run the full Gherkin test each time.

Mapping the BDD spec framework to Gherkin tests

If you previously worked with Gherkin, the following table can help you understand where to do various tasks in BDD.

In the Gherkin test framework: In the BDD spec framework:
Versioning, execution, automation, and backlog coverage are at the Gherkin test level.

Versioning is at the BDD specification level.

Execution, automation, and backlog coverage are at the scenario level.

You can add a Gherkin test to a suite. You can add scenarios to a suite.
Tests can be run manually or automatically. Scenarios can be run manually or automatically.

Back to top

Next steps: