PyCharm 2023.3 Help

BDD Testing Framework

Overview

Behavior-driven development, or BDD, makes it possible to write tests in a human-readable language.

PyCharm supports Gherkin-based frameworks, such as Behave.

Running a feature file

PyCharm provides the ability to run a specific feature file, or all feature files in a folder, which is specified in the corresponding run/debug configurations for Behave.

The procedure of running tests is the same as for the other testing frameworks:

  1. Open the desired feature in the editor, or select it in the Project tool window.

  2. Do one of the following:

    • Right-click the selected file or folder, and choose Run <feature file name> on the context menu of the selection.

    • Create run/debug configuration for one of the BDD frameworks, and specify the desired file of folder there.

Renaming steps

When renaming Gherkin steps, mind the following limitations:

  • Step definitions should not contain regular expressions

  • Step names should contain alphanumeric characters only.

  • A step definition should be only one in various frameworks.

  • There should be a "one-to-one" mapping between a step and a step definition.

For more information, refer to the section Renaming.

Last modified: 07 March 2024