A VS Code extension for running, debugging, and navigating Behave (Python BDD) scenarios.
Run or debug Behave scenarios directly from your .feature files using CodeLens.
- Run Scenario: Click the play button above any
ScenarioorScenario Outline - Debug Scenario: Click the bug button to start a debugging session
- Run Feature: Run all scenarios in a feature file
Ctrl+Click (Cmd+Click on Mac) on any step in a .feature file to navigate to its Python definition.
Supports all Behave patterns:
- Typed placeholders:
{name:d},{value:f},{word:w} - Untyped placeholders:
{name} - Scenario Outline placeholders:
<variable>
Ctrl+Click (Cmd+Click on Mac) on a step function in Python to see all .feature files where that step is used. This works on any function decorated with @given, @when, @then, or @step.
Start typing a step after Given, When, Then, And, or But and get autocomplete suggestions based on your existing Python step definitions.
- Filters suggestions by keyword (
Givenshows@given+@stepdefinitions) - Converts Behave placeholders to VS Code snippets for easy tab completion
- Resolves
And/Butto their parent keyword for accurate filtering
Get real-time warnings for steps in .feature files that don't have a matching Python definition. Undefined steps are highlighted with a yellow underline.
Format your .feature files with proper Gherkin indentation and table alignment.
- Format Document: Use
Shift+Alt+F(orShift+Option+Fon Mac) to format the entire file - Format Selection: Select a range and format just that section
- Proper indentation for
Feature,Scenario, steps, and tables - Automatic table column alignment
- Tag and doc string formatting
- Supports
Rulekeyword with nested indentation
Full syntax highlighting for .feature files including keywords, strings, comments, tags, and data tables.
| Setting | Description | Default |
|---|---|---|
behaveRunner.debug.justMyCode |
Only debug user code (skip library code) | true |
behaveRunner.stepDefinitions.patterns |
Glob patterns for Python step definition files | ["**/steps/**/*.py", "**/*_steps.py", "**/step_*.py", "**/steps.py"] |
behaveRunner.featureFiles.patterns |
Glob patterns for Gherkin feature files | ["**/*.feature"] |
behaveRunner.additionalArgs |
Additional command-line arguments to pass to Behave | [] |
To disable output capturing (useful for debugging with print statements):
{
"behaveRunner.additionalArgs": ["--no-capture", "--no-capture-stderr"]
}Common Behave arguments:
--no-capture- Don't capture stdout--no-capture-stderr- Don't capture stderr--tags=@smoke- Run only scenarios with specific tags--dry-run- Invokes formatters without running steps--no-skipped- Don't print skipped steps
- Python with Behave installed (
pip install behave)