cucumber-step-definitions

Create maintainable Cucumber step definitions for JavaScript, Java, and Ruby.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill cucumber-step-definitions
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cucumber-step-definitions
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-cucumber/skills/cucumber-step-definitions
Command: npx skills add https://github.com/TheBushidoCollective/han --skill cucumber-step-definitions

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you craft maintainable step definitions and organize test code for Cucumber across multiple languages.

Core Features & Use Cases

  • Basic step definitions: Given/When/Then for JavaScript, Java, and Ruby.
  • Parameterized steps: Capture dynamic values in scenarios.
  • Data tables & world context: Manage structured data and shared state.
  • Hooks: Setup and teardown scaffolding for tests.

Quick Start

Define a Given step in JavaScript to navigate to the login page and a Then step to verify a welcome message.

Frequently Asked Questions about cucumber-step-definitions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Cucumber step definitions that work across JavaScript, Java, and Ruby?

Step definitions translate Gherkin scenarios into executable test code using language-specific syntax: Cucumber.js for JavaScript/TypeScript, Cucumber-JVM for Java, and Ruby Cucumber. Each language uses Given/When/Then keywords to bind steps, with support for parameterized values, data tables, and shared World context for state management across steps.

What's the best way to organize reusable Cucumber steps for maintainability?

Organize steps by feature domain, use parameterized step definitions to reduce duplication, apply the Page Object pattern to encapsulate UI interactions, leverage World context for shared test state, and implement hooks for setup and teardown. This structure scales test code and makes steps reusable across multiple scenarios.

Can I use data tables and doc strings in Cucumber step definitions?

Yes. Data tables extract structured input directly into step code for multi-row assertions, while doc strings capture multi-line text blocks like JSON payloads or SQL. Both are passed as arguments to step definitions, enabling complex test data handling without scenario clutter.

How do I capture dynamic values in Cucumber scenarios using parameterized steps?

Parameterized steps use regular expressions or cucumber expressions to extract values from Gherkin text and pass them as arguments to step methods. This lets you write a single step definition that matches multiple scenario variations with different inputs, reducing step duplication.

What's the difference between Gherkin-to-code mapping and traditional test automation?

Gherkin mapping bridges business-readable scenarios and executable code, making tests accessible to non-technical stakeholders while maintaining technical accuracy. Step definitions handle this translation with robust pattern matching, data extraction, and cross-language support across JavaScript, Java, and Ruby.

Do I need hooks for test setup and teardown with Cucumber step definitions?

Hooks are optional but recommended for managing test lifecycle—Before hooks run pre-test setup, After hooks handle cleanup. They work across all three languages and integrate with World context to maintain shared state, reducing boilerplate in individual steps.