Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Selenium-Cucumber ProNew to Visual Studio Code? Get it now.
Selenium-Cucumber Pro

Selenium-Cucumber Pro

Gyana Prakash Khandual

|
7,208 installs
| (1) | Free
Professional Selenium Java step definition generator for Cucumber BDD testing with advanced features and code formatting
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Selenium-Cucumber Pro

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

Version Downloads License: MIT


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

  1. Open VS Code
  2. Go to the Extensions panel (Ctrl+Shift+X)
  3. Search for Selenium-Cucumber Pro
  4. Click Install

Quick Start

  1. Open a .feature file
  2. Press Ctrl+Shift+G or click Cucumber Steps in the status bar
  3. Choose Generate Step Definitions
  4. 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

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