A powerful VS Code extension that seamlessly integrates Cucumber feature files with VS Code's Test Explorer. Run and debug your Java Cucumber tests directly from the test panel with a clean, modern interface.
This is an enhanced version of the original Cucumber Java Easy Runner with significant improvements:
- π Multi-Platform Availability (v1.0.7+): Now available on both VS Code Marketplace AND Open VSX Registry
- β Full support for Cursor, VSCodium, Eclipse Theia, Gitpod, and other VS Code-based editors
- β Automated dual publishing to both marketplaces
- β Real Test Results: Tests are now marked as passed β or failed β based on actual Cucumber execution results (not just "always passed")
- π Individual Scenario Results: When running entire features, each scenario is marked individually with its real result
- π Precise Error Location: Error markers appear on the exact line of the failed step, making debugging instant
- π― Detailed Error Messages: See the exact step that failed with complete stack trace and error details
- π Multiple Failure Support: When multiple scenarios fail, each shows its specific error at the correct location
- β‘ Optimized Maven Compilation: Only compiles when
target
folder doesn't exist (much faster execution) - now configurable! - π Debug & Run Modes: Both modes now use the same unified approach with proper result tracking
- π JSON Result Analysis: Uses Cucumber's JSON output to determine pass/fail status with detailed error messages
- π§Ή Code Refactoring: Consolidated duplicate code and extracted result processing into dedicated module
- π§ Cleaner Architecture: Simplified codebase with better separation of concerns
- βοΈ Flexible Configuration: Control compilation, exclude directories, and add external step definitions (v1.0.6+)
- Unified Test Execution: Single
runCucumberTest()
function handles both run and debug modes - Result File Analysis: Uses
--plugin json:${resultFile}
to capture detailed test results - Dedicated Result Processor: New
resultProcessor.ts
module handles all test result parsing and marking - Precise Line Matching: Exact numeric comparison prevents false positives (e.g., line 5 vs line 57)
- Smart Compilation: Maven compilation only runs when needed (checks for
target
directory) - Consolidated Methods: Merged duplicate methods (
runTests
/debugTests
,runSingleTest
/debugSingleTest
) - DRY Principles: Eliminated code repetition throughout the codebase
- π§ͺ Test Explorer Integration: All your Cucumber features and scenarios appear in VS Code's Test Explorer panel
- β Real Pass/Fail Status: Tests show actual results from Cucumber execution
- π― Individual Scenario Execution: Run specific scenarios without executing the entire feature
- π Full Debug Support: Debug your step definitions with breakpoints
- π Detailed Results: See which scenarios passed and which failed, with error details
- π Auto-discovery: Automatically finds and displays all feature files in your workspace
- π« Smart Filtering: Excludes build directories (target, build, out) to prevent duplicate tests
- β‘ Fast Refresh: Instantly refresh test list when new features are added
- π§ Auto-configuration: Automatically detects glue path, no manual setup required
- π Optional CodeLens: Enable traditional play buttons in feature files if preferred
The primary way to run Cucumber tests is through VS Code's Test Explorer:
- Open Test Explorer: Click the test tube icon in the activity bar or press
Ctrl+Shift+T
- View Your Tests: All feature files and scenarios are automatically discovered and displayed
- Run Tests: Click the play button next to any feature or scenario to run it
- Debug Tests: Right-click and select "Debug Test" to debug with breakpoints
- View Results: Tests are marked with β (passed) or β (failed) based on actual execution
π§ͺ Test Explorer
ββ π Cucumber Java Tests
ββ π Login Feature
β ββ β
Successful login
β ββ β Failed login with wrong password β Shows real failure!
β ββ β
Password reset flow
ββ π Shopping Cart Feature
β ββ β
Add item to cart
β ββ β
Remove item from cart
β ββ β Checkout process β Shows which scenario actually failed!
ββ π User Registration Feature
ββ β
Valid registration
ββ β Invalid email format β Click to see error details
When you run an entire feature file:
- Each scenario is executed
- Each scenario is marked individually with its own pass/fail status
- You can see at a glance which scenarios passed and which failed
- Click on failed scenarios to see error details
- Right-click any test β "Debug Test"
- Set breakpoints in your step definitions
- Step through your code with full debugging support
- Even in debug mode, tests are marked with correct pass/fail status after execution
If you prefer the traditional approach with play buttons in feature files:
- Enable CodeLens: Go to VS Code Settings β Extensions β Cucumber Java Runner
- Check "Enable CodeLens": This will show play buttons directly in your feature files
- Use Play Buttons: Click the buttons that appear on Feature, Scenario, and Example lines
Example feature file with CodeLens enabled:
βΆ Run Feature | π Debug Feature
Feature: Shopping Cart
βΆ Run Scenario | π Debug Scenario
Scenario: Adding an item to cart
Given I am on the product page
When I click "Add to Cart"
Then the item should be added to my cart
βΆ Run Scenario | π Debug Scenario
Scenario Outline: User login
Given I enter "<username>" and "<password>"
Then I should see "<result>"
Examples:
| username | password | result |
| admin | admin123 | Welcome! |
| user1 | pass123 | Welcome! |
You can also right-click on feature files:
- Right-click on a
.feature
file in the file explorer β "Cucumber: Run Feature" - Right-click in an open feature file β "Cucumber: Run Feature/Scenario/Example"
- Right-click in an open feature file β "Cucumber: Debug Feature/Scenario/Example"
Access settings via: Settings β Extensions β Cucumber Java Runner or edit your settings.json
file directly.
Setting | Type | Default | Description |
---|---|---|---|
cucumberJavaRunner.enableCodeLens |
boolean | false |
Enable CodeLens buttons (βΆ Run, π Debug) in feature files. When disabled, use Test Explorer instead for a cleaner interface. |
cucumberJavaRunner.objectFactory |
string | "" |
Custom Cucumber ObjectFactory class for dependency injection (e.g., Spring, Guice, PicoContainer). Leave empty for default. |
cucumberJavaRunner.autoCompileMaven |
boolean | true |
Automatically compile Maven projects before running tests (only when target directory is missing). |
cucumberJavaRunner.excludeBuildDirectories |
array | ["target", "build", "out", "dist", "node_modules", ".git"] |
Directories to exclude when discovering feature files to avoid duplicates. |
cucumberJavaRunner.additionalGluePaths |
array | [] |
Additional glue paths for step definitions (e.g., from external libraries). Use Java package format. |
{
"cucumberJavaRunner.objectFactory": "cucumber.api.spring.SpringFactory"
}
{
"cucumberJavaRunner.objectFactory": "cucumber.api.guice.GuiceFactory"
}
{
"cucumberJavaRunner.autoCompileMaven": false
}
{
"cucumberJavaRunner.excludeBuildDirectories": [
"target",
"build",
"generated",
"bin"
]
}
Use this when you have step definitions in external libraries or modules:
{
"cucumberJavaRunner.additionalGluePaths": [
"com.external.library.steps",
"org.another.library.cucumber.steps"
]
}
{
"cucumberJavaRunner.enableCodeLens": true
}
{
"cucumberJavaRunner.enableCodeLens": false,
"cucumberJavaRunner.objectFactory": "cucumber.api.spring.SpringFactory",
"cucumberJavaRunner.autoCompileMaven": true,
"cucumberJavaRunner.excludeBuildDirectories": [
"target",
"build",
"out",
"dist"
],
"cucumberJavaRunner.additionalGluePaths": [
"com.mycompany.shared.steps"
]
}
- Clean, organized view of all tests
- Integrated with VS Code's testing framework
- Shows real test status with β /β icons
- Detailed error messages on failures
- No visual clutter in feature files
- Traditional play buttons in feature files
- Similar to IntelliJ IDEA experience
- Enable via settings if preferred
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X
) - Search for "Cucumber Java Runner"
- Click Install
Or install directly from VS Code Marketplace
- Open your editor
- Go to Extensions view (
Ctrl+Shift+X
) - Search for "Cucumber Java Runner"
- Click Install
Or install directly from Open VSX Registry
- Download the
.vsix
file from Releases - Open Extensions view β "..." menu β "Install from VSIX"
- Select the downloaded file
- Java: JDK 8 or higher
- Maven: 3.6 or higher
- Project Structure: Standard Maven layout
- Dependencies: Cucumber-JVM in your pom.xml
- VS Code Extension: Java Extension Pack (for debugging support)
This extension is designed to work seamlessly with the Official Cucumber Extension.
Recommended Setup: Install both extensions together!
- Official Cucumber: Provides syntax highlighting, formatting, validation, and step navigation
- This Extension: Provides test execution, debugging, and Test Explorer integration
See USING_WITH_CUCUMBER_OFFICIAL.md for detailed compatibility guide.
The extension works automatically with standard Maven projects:
- β Auto-detects step definition glue path
- β Finds all feature files in your workspace
- β Excludes build directories automatically
- β Integrates with VS Code Test Explorer
- β Optimized Maven compilation (only when needed)
If auto-detection fails, you'll be prompted to enter your glue path manually (e.g., com.example.steps
).
Automatic: New feature files are detected automatically Manual: Use the refresh button in Test Explorer or Command Palette β "Refresh Cucumber Tests"
- Test Discovery: Scans workspace for
.feature
files - Auto-compilation: Compiles Maven project only if
target
folder doesn't exist - Test Execution: Runs Cucumber with
--plugin json:${resultFile}
to capture results - Result Analysis: Reads JSON output to determine pass/fail status for each scenario
- UI Update: Updates Test Explorer with β (passed) or β (failed) icons
- Cleanup: Removes temporary JSON result files
Tests not showing in Test Explorer:
- Make sure you have
.feature
files in your workspace - Check that files aren't in excluded directories (target, build, out)
- Use the refresh button in Test Explorer
- Check VS Code Output panel β "Cucumber Java Runner" for logs
CodeLens buttons not showing:
- Enable CodeLens in extension settings
- Make sure you're viewing a
.feature
file - Reload VS Code window
Glue path errors:
- Extension will prompt you to enter the path manually
- Use Java package format:
com.example.steps
- Check your step definitions are in the correct package
Test execution issues:
- Verify Maven project structure (standard layout)
- Check Cucumber dependencies in pom.xml
- Ensure Java and Maven are in your PATH
- Check terminal output for detailed error messages
Tests always showing as passed (old versions):
- Update to latest version! This fork fixes that issue.
- Make sure you're using version 1.0.0 or higher
Compilation is slow:
- This fork optimizes compilation! Only runs when
target
folder doesn't exist - Delete
target
folder to force recompilation when needed
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch mode (auto-compile on changes)
npm run watch
# Package extension
npx vsce package
# Install locally for testing
code --install-extension cucumber-java-runner-1.0.0.vsix
# or
cursor --install-extension cucumber-java-runner-1.0.0.vsix
Feature | Original | This Fork |
---|---|---|
Test Results | Always "passed" |
Real pass/fail status β |
Individual Scenario Results | No β | Yes β |
Maven Compilation | Always runs π | Smart/optimized β‘ |
Code Duplication | High π | Low (refactored) π― |
Debug Mode Results | No tracking β | Full tracking β |
Error Messages | Generic |
Detailed with step info π |
Architecture | Separate runners π | Unified runner π― |
Found a bug or have a feature request? Please report it on GitHub Issues.
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
See CHANGELOG.md for detailed version history.
This project is a fork of Cucumber Java Easy Runner by Hakki Etem.
Enhanced and maintained by: Lucas Biel (@lucasbiel7)
Major improvements include:
- Real test result tracking
- Individual scenario result marking
- Optimized Maven compilation
- Code refactoring and consolidation
- Better error messages and debugging support
Enjoy testing with Cucumber! π₯β¨
If you find this extension helpful, please β star the repository and leave a review on the marketplace!