Selenium-Cucumber Pro
A VS Code extension that generates professional Selenium Java step definitions from Cucumber .feature files — instantly.

What It Does
Open any Cucumber feature file, run one command, and get a complete, compilable Java step definition class on your clipboard — including annotations, try-catch blocks, parameter handling, and Selenium scaffolding.
Installation
- Open VS Code
- Go to the Extensions panel (
Ctrl+Shift+X)
- Search for Selenium-Cucumber Pro
- Click Install
Quick Start
- Open a
.feature file
- Press
Ctrl+Shift+G or click Cucumber Steps in the status bar
- Choose Generate Step Definitions
- Paste into your Java project
Commands
| Command |
Shortcut |
Description |
| Generate Step Definitions |
Ctrl+Shift+G |
Generate from the entire file or current selection |
| Quick Actions |
Ctrl+Shift+Q |
Open the actions menu |
| Generate from Selection |
Ctrl+Shift+S |
Generate only from selected steps |
Right-click inside any .feature file for context menu access to all commands.
Configuration
Open Settings (Ctrl+,) and search for Cucumber, or use the Configure Settings action in the Quick Actions menu.
{
"cucumberStepGen.packageName": "com.example.stepdefinitions",
"cucumberStepGen.className": "StepDefinitions",
"cucumberStepGen.baseTestClass": "BaseTest",
"cucumberStepGen.framework": "cucumber",
"cucumberStepGen.generateComments": true,
"cucumberStepGen.generateTryCatch": true,
"cucumberStepGen.methodNamingConvention": "camelCase"
}
Example
Input — feature file
Feature: Login
Scenario: Successful login
Given I am on the login page
When I enter username "admin" and password "secret"
Then I should see the dashboard
Output — generated Java
package com.example.stepdefinitions;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.When;
import io.cucumber.java.en.Then;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;
/**
* Cucumber Step Definitions
* Generated by Selenium-Cucumber Extension
*/
public class StepDefinitions {
private WebDriver driver;
@Given("^I am on the login page$")
public void iAmOnTheLoginPage() {
try {
// TODO: driver.get("URL");
} catch (Exception e) {
throw new RuntimeException("Failed to execute step", e);
}
}
@When("^I enter username \"(.*?)\" and password \"(.*?)\"$")
public void iEnterUsernameAndPassword(String param1, String param2) {
try {
// TODO: implement login logic
} catch (Exception e) {
throw new RuntimeException("Failed to execute step", e);
}
}
}
Parameter Detection
The extension automatically detects and converts:
"quoted strings" → "(.*?)" → String param
<angle brackets> → (.*) → String tokenName
123 bare numbers → (\\d+) → int number
Project Structure
src/
extension.ts Entry point — registers commands and status bar
stepGenerator.ts Orchestrates the full generation pipeline
stepParser.ts Parses feature file text into structured data
codeGenerator.ts Emits Java source from structured data
fileManager.ts File I/O and output preview
quickActions.ts Quick Actions menu and About dialog
configuration.ts Reads and writes workspace settings
types.ts Shared TypeScript interfaces
Contributing
Contributions are welcome. Please read CONTRIBUTING.md before opening a pull request.
License
MIT — see LICENSE for details.
Made by Gyana Prakash Khandual · GitHub · Report an Issue