Cucumber Test Runner for VS Code
A powerful VS Code extension that provides code lens support for running and debugging Cucumber tests directly from your feature files.

Features
- Code Lens Integration: Run and debug individual scenarios or entire features with one click
- Test Explorer: Tree view showing all features and scenarios in your workspace
- Works with Cucumber.js
- Smart Working Directory Detection: Automatically finds and uses the directory containing
cucumber.json
- Configurable Environment Variables: Set custom environment variables for test execution
- Temporary Console Support: Creates dedicated terminals for test execution
- Debug Support: Full debugging capabilities with breakpoints and step-through debugging

Installation
- Download the
.vsix
file from the releases
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X
)
- Click the
...
menu and select "Install from VSIX..."
- Select the downloaded
.vsix
file
Alternatively, search for "Cucumber Test Runner" in the VS Code Extensions Marketplace.
Usage
Test Explorer
- Open the Test Explorer view in the sidebar (Testing tab)
- You'll see a "Cucumber Tests" section showing all your feature files
- Features are displayed as folders with their scenarios listed underneath
- Click on any item to navigate to that location in the file
- Use the inline buttons to run or debug specific features or scenarios
- Use the refresh button to update the test tree when files change

Note: You can disable the Test Explorer entirely by setting cucumber-test-runner-new.enableTestExplorer
to false
in your VS Code settings. This will hide the test explorer view and only use code lens functionality.
Running Tests
- From Code Lens: Open any
.feature
file and click the code lens buttons
- From Test Explorer: Click the run button next to any feature or scenario
- Run All Tests: Click the "Run All Tests" button in the Test Explorer toolbar
Debugging Tests
- From Code Lens: Click "Debug Feature" or "Debug Scenario" from the code lens
- From Test Explorer: Click the debug button next to any feature or scenario
- Set breakpoints in your step definitions
- The debugger will stop at breakpoints during test execution
Configuration
Configure the extension through VS Code settings:
{
"cucumber-test-runner-new.environmentVariables": {
"NODE_ENV": "test",
"API_URL": "http://localhost:3000"
},
"cucumber-test-runner-new.debugEnvironmentVariables": {
"DEBUG": "cucumber*",
"LOG_LEVEL": "debug"
},
"cucumber-test-runner-new.testRunner": "cucumber-js",
"cucumber-test-runner-new.profile": "dev",
"cucumber-test-runner-new.enableCodeLens": true,
"cucumber-test-runner-new.enableTestExplorer": true
}
Available Settings
Setting |
Type |
Default |
Description |
cucumber-test-runner-new.enableCodeLens |
boolean |
true |
Enable/disable code lens functionality |
cucumber-test-runner-new.enableTestExplorer |
boolean |
true |
Enable/disable the Experimental Cucumber Test Explorer view in the Testing sidebar |
cucumber-test-runner-new.environmentVariables |
object |
{} |
Environment variables for test execution |
cucumber-test-runner-new.debugEnvironmentVariables |
object |
{} |
Additional environment variables for debugging (merged with environmentVariables) |
cucumber-test-runner-new.testRunner |
string |
"cucumber-js" |
Test runner: cucumber-js |
cucumber-test-runner-new.profile |
string |
"" |
Cucumber profile to use (applies to cucumber-js only) |
Environment Variables
The extension supports two types of environment variable configurations:
1. Test Execution Variables
Applied when running tests:
{
"cucumber-test-runner-new.environmentVariables": {
"NODE_ENV": "test",
"API_URL": "http://localhost:3000",
"DATABASE_URL": "test_database"
}
}
2. Debug Variables
Additional variables for debugging (merged with test execution variables):
{
"cucumber-test-runner-new.debugEnvironmentVariables": {
"DEBUG": "cucumber*",
"LOG_LEVEL": "debug",
"VERBOSE": "true"
}
}
Supported Test Runners
Cucumber.js (Node.js)
- Default configuration
- Supports
npx cucumber-js
commands
- Full debugging with Node.js debugger
Working Directory Detection
The extension automatically detects the correct working directory by:
- Looking for
cucumber.json
in parent directories
- Checking for cucumber configuration in
package.json
- Using the detected directory as the working directory for test execution
Requirements
- VS Code 1.74.0 or later
- Node.js (for Cucumber.js)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
0.0.1
- Initial release
- Code lens support for running and debugging tests
- Multi-framework support (Cucumber.js, pytest-bdd, SpecFlow)
- Configurable environment variables
- Smart working directory detection
Support
If you encounter any issues or have questions, please email them to vscode-cucumber-testrunner-new@outlook.com. In coming days code for the extension will be open sourced.
Acknowledgments
- Built with the VS Code Extension API
- Supports the Cucumber ecosystem
- Inspired by the need for better BDD testing tools in VS Code
- Built with (90%) help of Github copilot.