Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Pytest BDDNew to Visual Studio Code? Get it now.
Pytest BDD

Pytest BDD

Vassilis Tenentes

|
19,990 installs
| (4) | Free
BDD Helper
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PYTEST-BDD UNOFFICIAL README

pytest-bdd extension

Quick Start

  • The extension is activated when a feature or python file is opened

  • Find a sample repository here


Features

  • Syntax Highlighting for feature files

  • Auto Completions for BDD steps while editing a feature file

  • Redirecting from the feature bdd step to the step definition function (right click, Bdd->Step Definition) by clicking ctr+shift+down

  • Run any bdd scenario directly from the feature file (right click, Bdd-> Run Scenario) by clicking ctr+shift+r (also available with no bdd tests)

  • Debug any scenario directly from the feature file (right click, Bdd-> Debug Scenario) by clicking ctr+shift+t (also available with no bdd tests)

  • Demo
  • Integrated Test explorer:

    • Test explorer: Run/Debug tests by selecting folders, python test files, feature files or single scenarios

    • Test explorer: Redirect from the test explorer item to the file

    • Test explorer: Check last output by clicking an item (not available for debugging)

    • Test explorer: Option to show only BDD scenarios

    • Demo
  • Find bdd step decorator references (right click, Bdd-> Find References). Results are shown in 'BDD References' view container

  • Delete Pytest Cache in workspace (Ctr+Shift+p, Bdd-> Delete Pytest Cache Files). This commands works only if the default terminal is "Windows PowerShell"

  • Create Step Definition (right click, Bdd-> Create Step).
    Use the following setting to set your parser (default value is "Parser")

     "PytestBdd.parser": "cfparse"
    
    Demo

Requirements

  • Python (ms-python.python) addon installed

  • Disable any "gherkin", "cucumber" related addons

  • BDD tests should follow this structure:

  •     rootdir\
                example1\
                        features\
                                my_feature_1.feature
                                my_feature_2.feature
                        step_defs\
                                my_steps_1_steps.py (must end with '_steps.py')
                                my_steps_2_steps.py
                        test_run_my_features.py (must start with 'test_' and to include the features, scenarios("./features/"))
                        __init__.py
    
  • Restart vscode after installing this extension


Extension Settings

  • Add the following setting to your json settings file:

  •     "editor.semanticTokenColorCustomizations": {
            "enabled": true, // enable for all themes
        },
    

Themes tested

  • Darcula Pycharm with Light GUI

  • Darcula Pycharm with Dark GUI

  • Light (Visual Studio)

  • Light+ (default light)

  • Dark (Visual Studio)

  • Dark+ (default dark)


Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft