BDD Testing Framework
In this section:
- BDD Testing Framework
- Creating .Feature Files
- Creating Step Definition
- Supporting Regular Expressions in Step Definitions
- Navigating from .Feature File to Step Definition
- Creating Examples Table in Scenario Outline
Overview
Behavior-driven development, or BDD, makes it possible to write tests in a human-readable language.
PyCharm supports Gherkin and the Cucumber-based frameworks for Python: Behave and Lettuce.
Find information on testing in the section Testing. This section deals with Behave and Lettuce frameworks only.
Running a feature file
PyCharm provides the possibility to run a specific feature file, or all feature files in a folder, which is specified in the corresponding run/debug configuration for Behave or Lettuce.
The procedure of running tests is the same as for the other testing frameworks:
- Open the desired feature feature in the editor, or select it in the Project tool window.
- Do one of the following:
- Right-click the selected file or folder, and choose . 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 not contain non-alpha numeric characters.
- 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.
Refer to the section Renaming for details.
See Also
Procedures:
Last modified: 20 April 2016