Hubbry Logo
Cucumber (software)Cucumber (software)Main
Open search
Cucumber (software)
Community hub
Cucumber (software)
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Cucumber (software)
Cucumber (software)
from Wikipedia
Cucumber
DevelopersAslak Hellesøy,[1] Joseph Wilk,[2] Matt Wynne,[3] Gregory Hnatiuk,[4] Mike Sassak[5]
Stable release
12.5.0[6] Edit this on Wikidata / 26 December 2025
Written inRuby
Operating systemCross-platform
TypeBehavior driven development framework / Test tool
LicenseMIT License
Websitecucumber.io
Repository

Cucumber is a software tool that supports behavior-driven development (BDD).[7][8][9][10][11][12] Central to the Cucumber BDD approach is its ordinary language parser called Gherkin. It allows expected software behaviors to be specified in a logical language that customers can understand. As such, Cucumber allows the execution of feature documentation written in business-facing text.[13][7][8] It is often used for testing other software.[14] It runs automated acceptance tests written in a behavior-driven development (BDD) style.[15]

Cucumber was originally written in the Ruby programming language[7][16][8] and was originally used exclusively for Ruby testing as a complement to the RSpec BDD framework. Cucumber now supports a variety of different programming languages through various implementations, including Java[17][8] and JavaScript.[18][19] There is a port of Cucumber to .NET called SpecFlow,[20][21][22] now superseded by Reqnroll.[23]

Gherkin language

[edit]

Gherkin is the language that Cucumber uses to define test cases. It is designed to be non-technical and human readable, and collectively describes use cases relating to a software system.[7][8][24][25] The purpose behind Gherkin's syntax is to promote behavior-driven development practices across an entire development team, including business analysts and managers. It seeks to enforce firm, unambiguous requirements starting in the initial phases of requirements definition by business management and in other stages of the development lifecycle.

In addition to providing a script for automated testing, Gherkin's natural language syntax is designed to provide simple documentation of the code under test.[25] Gherkin currently supports keywords in dozens of languages.[25][26][7][8]

Syntax

[edit]

Syntax is centered around a line-oriented design, similar to that of Python. The structure of a file is defined using whitespace and other control characters.[25] Lines starting with # are considered comments, and can be placed anywhere in a file.[25] Instructions are any non-empty and non-comment line. They consist of a recognized Gherkin keyword followed by a string.[27]

All Gherkin files have the .feature file extension. They contain a single Feature definition for the system under test and are an executable test script.[27]

Here is an example of the syntax:[28]

Feature: Guess the word

  # The first example has two steps
  Scenario: Maker starts a game
    When the Maker starts a game
    Then the Maker waits for a Breaker to join

  # The second example has three steps
  Scenario: Breaker joins a game
    Given the Maker has started a game with the word "silky"
    When the Breaker joins the Maker's game
    Then the Breaker must guess a word with 5 characters

Command line

[edit]

Cucumber comes with a built-in command line interface that covers a comprehensive list of instructions. Like most command line tools, cucumber provides the --help option that provides a summary of arguments the command accepts.[29]

$ cucumber --help
        -r, --require LIBRARY|DIR        Require files before executing the features.
        --i18n LANG                      List keywords for in a particular language.
                                         Run with "--i18n help" to see all languages.
        -f, --format FORMAT              How to format features (Default: pretty).
        -o, --out [FILE|DIR]             Write output to a file/directory instead of
        ...

Cucumber command line can be used to quickly run defined tests. It also supports running a subset of scenarios by filtering tags.

$ cucumber --tags @tag-name

The above command helps in executing only those scenarios that have the specified @tag-name.[29] Arguments can be provided as a logical OR or AND operation of tags. Apart from tags, scenarios can be filtered on scenario names.[29]

$ cucumber --name logout

The above command will run only those scenarios that contain the word 'logout'.

It is also useful to be able to know what went wrong when a test fails. Cucumber makes it easy to catch bugs in the code with the --backtrace option.[29]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
Cucumber is an tool designed to support (BDD) by allowing teams to write and execute automated acceptance tests in plain, human-readable using the syntax, which consists of steps to describe application behavior. Developed initially in by Aslak Hellesøy in 2008 as an enhancement to the RSpec Story Runner, it was named "Cucumber" on a suggestion from Hellesøy's fiancée and quickly gained popularity for bridging communication gaps between business stakeholders and developers. BDD itself originated in the early 2000s, pioneered by Dan North (also known as Daniel Terhorst-North) to extend (TDD) with a focus on through examples, evolving from tools like JBehave in 2003. Key features of Cucumber include step definitions that map Gherkin scenarios to executable code, hooks for setup and teardown, tagging for selective execution, and reporting mechanisms to generate readable test outputs, making it suitable for living documentation of software requirements. It supports a wide range of programming languages through dedicated implementations, such as Cucumber-JVM for , Cucumber-JS for , and native support, enabling integration with frameworks like for UI testing or REST Assured for validation. By facilitating , Cucumber promotes clearer specifications and reduces misunderstandings in agile development processes, with maintenance by the Cucumber community following its acquisition by SmartBear in 2019 and transition to stewardship under the Open Source Collective in 2024.

Overview

Purpose and Benefits

Cucumber is an open-source tool designed to support (BDD) by allowing teams to write executable specifications using plain, business-readable language known as . This approach enables the creation of automated acceptance tests that serve as living documentation, bridging the communication gap between non-technical stakeholders and developers. BDD extends (TDD) by emphasizing collaboration among developers, testers, and business stakeholders to define software behavior through concrete examples, rather than focusing solely on code-level tests. It promotes structured conversations in agile environments, such as discovery workshops, to align on requirements and reduce ambiguities early in the development cycle. The primary benefits of Cucumber include enhanced team communication through scenarios that are accessible to all roles, fostering shared understanding and minimizing requirement misunderstandings. It generates evolving living documentation that automatically verifies against the system's behavior, supporting agile methodologies by enabling rapid iterations, quick feedback, and reduced manual . Additionally, Cucumber facilitates the of criteria, leading to more reliable software delivery with fewer defects. BDD was pioneered by Dan North between 2003 and 2006 as an evolution of agile practices to improve team collaboration and specification clarity, with emerging as a key practical implementation tool for executing these principles. For instance, teams at the have adopted Cucumber for automating acceptance criteria in their software projects.

Key Components

Cucumber's modular architecture consists of several core components that enable the execution of behavior-driven tests. At the foundation are feature files, which store Gherkin-based scenarios describing expected software behavior in format. These files serve as the primary input for the testing process, allowing non-technical stakeholders to define requirements. The Gherkin parser plays a crucial role by translating these feature files into an (AST), a structured representation that facilitates further processing and execution. This parser, part of the Cucumber core, tokenizes the input, builds the AST, and compiles it into simplified structures known as Pickles for efficient handling across implementations. Step definitions form another essential component, acting as code mappings that link individual Gherkin steps to executable actions in the application's programming language. These definitions bridge the gap between descriptive scenarios and actual implementation, ensuring that each step triggers the appropriate system behavior during test runs. The runner component orchestrates the overall test execution, loading feature files, matching steps to definitions, and invoking the necessary code. Cucumber distinguishes between its core, which handles parsing and protocol-agnostic logic, and language-specific runners such as Cucumber-JVM for Java, which integrate with the target runtime environment to perform the actual computations. An event-based underpins the interaction among components, where the runner emits via an internal event bus during parsing and execution phases. These , standardized through the Cucumber Messages protocol, allow hooks—special functions that intercept —to perform actions like setup or teardown without altering core flows. Formatters subscribe to these to generate reports in formats such as or , capturing outcomes like success or failure. Component interactions follow a sequential : scenario outlines in feature files are parsed into an AST by the Gherkin parser, steps are matched to definitions by the runner, execution proceeds with event emissions for monitoring and hooking, and finally, formatters process the events to produce reporting outputs. This design ensures , with the command-line runner serving as a common entry point for initiating the process.

History

Origins and Development

Cucumber was created in 2008 by Aslak Hellesøy as a Ruby-based tool designed to support (BDD) practices, initially serving as a complement to the RSpec framework. Hellesøy developed it to address limitations in RSpec's Story Runner, such as poor error messages and lack of support for step definition snippets, aiming to make automated testing more accessible and collaborative. The tool's core motivation was to bridge communication gaps in agile teams by enabling non-technical stakeholders, like product owners, to author executable specifications in , thereby fostering shared understanding of software behavior. The project drew significant influence from Dan North's foundational work on BDD, outlined in his 2006 article "Introducing BDD," which emphasized using to describe behaviors and promote among developers, testers, and representatives. Additionally, it built upon earlier BDD tools like JBehave, launched by North in 2003 as a Java-based framework for executable specifications. Cucumber introduced the Gherkin language alongside its launch, allowing scenarios to be written in a structured, human-readable format using keywords like Given, When, and Then. The first public release of Cucumber occurred in 2008 under the MIT open-source license, quickly gaining traction within the ecosystem for its integration with testing tools like RSpec and its emphasis on readable acceptance tests. Early adoption highlighted its utility in agile environments, where teams used it to align technical implementation with business requirements. By around 2010, the project expanded beyond Ruby with the release of Cucumber-JVM, a port for the platform that enabled broader use in enterprise settings and JVM-based languages. This period marked the beginning of multi-language support, solidifying Cucumber's role as a cross-platform BDD tool.

Major Releases and Milestones

Cucumber-Ruby achieved its first stable release with version 1.0 in July 2011, marking a milestone in providing reliable (BDD) support for projects. This version emphasized stability and laid the foundation for broader adoption beyond initial prototypes. Subsequent minor updates in 2011 and 2012 refined core functionality. In 2018, Cucumber-JVM released version 4.0, featuring a major refactor to improve and dependency management, enabling better integration with ecosystems like Maven. This update addressed performance bottlenecks in earlier iterations and supported parallel execution enhancements, responding to growing demands in enterprise Java testing. By 2021, Cucumber unified its core across implementations with version 7.0 releases—for in July and JVM in October—standardizing the Gherkin parser and runtime to simplify maintenance across languages. A significant organizational milestone occurred in June 2019 when Cucumber Ltd., founded in 2013 to provide commercial services and products supporting the open-source project, was acquired by SmartBear, which aimed to enhance resources for open-source maintenance and commercial tools like CucumberStudio. This acquisition initially boosted development but led to community concerns in 2023 over slower updates and layoffs of key contributors, raising fears about the project's sustainability. These issues were addressed in December 2024 when the project returned to full , revitalizing contributions. Other notable milestones include the maturation of JavaScript support through Cucumber.js, with stable integrations solidifying around 2015 to accommodate environments. In 2022, version updates included deprecations of legacy options to streamline outputs to modern reporters. As of November 2025, Cucumber remains actively developed under community governance, with recent releases like Ruby v10.1.1 (October 8, 2025) and JVM v7.31.0 (October 28, 2025) focusing on compatibility with cloud platforms such as AWS and Azure, alongside emerging AI-assisted tools for scenario generation in the broader ecosystem.

Gherkin Language

Syntax and Structure

Gherkin feature files, which use the .feature extension, must be encoded in to ensure proper handling of international characters and keywords across supported languages. A Gherkin file begins with a single Feature keyword followed by a colon and a descriptive title, establishing the high-level capability or functionality under test. This is optionally preceded by tags, denoted by @ symbols on the line above the Feature, which allow grouping and selective execution of features or scenarios. Below the Feature title, a multi-line description in free-form text can provide context, terminating at the next keyword or structural element. The hierarchical organization includes an optional Background section, which contains shared steps executed before each scenario within the feature, promoting reusability for common preconditions. Following the Background, the file defines one or more Scenario or Scenario Outline blocks. A Scenario represents a single executable test case, while a Scenario Outline supports parameterization through an Examples table for data-driven testing. Each scenario or outline includes a title and optional description, followed by a sequence of steps that form the core executable content. Syntax rules enforce an indentation-based structure using consistent spaces or tabs, recommended at two spaces per level, ensuring parseability without ambiguity. Comments begin with # at the start of a line and are ignored during execution. Data tables, used for passing structured data to steps, are delimited by vertical bars (|) in pipe-separated rows, with support for escaping special characters like newlines (\n), pipes (|), and backslashes (\). Doc strings for multi-line inputs, such as JSON or XML, are enclosed in triple double quotes (""") or triple backticks (```), preserving indentation relative to the step. The parsing process begins with a scanner that reads the feature file line by line, converting content into based on keywords, indentation, and delimiters. These are then fed to a parser, which constructs an (AST) representing the document's structure, including features, scenarios, and steps. A # language: header at the file's start can reconfigure the lexer for non-English keywords, enabling localization in over 70 s. During execution, step matching against definitions handles potential ambiguities by requiring unique patterns; if multiple definitions match the same step text, an AmbiguousStepDefinitionsException is thrown to prevent nondeterministic behavior. Unlike plain English, mandates strict keyword usage—such as those for steps—to impose a formalized, structure that bridges readability with programmatic precision. This ensures scenarios are not merely descriptive but directly mappable to step definitions for automated testing.

Keywords and Usage Examples

employs a structured set of keywords to define specifications in a human-readable format, enabling collaboration between technical and non-technical stakeholders in . These keywords provide semantic meaning to scenarios, distinguishing between setup, actions, outcomes, and organizational elements. The core keywords include Feature, which describes the high-level functionality under test and must appear at the beginning of a file, followed by a title and optional description. outlines a specific example of the feature's behavior, typically containing 3-5 steps for clarity. Given establishes the initial context or preconditions, such as "Given the user is not logged in." When specifies the action or event that triggers the behavior, for instance, "When the user submits valid credentials." Then asserts the expected outcome or postcondition, like "Then the user is redirected to the dashboard." And and But serve as continuations to chain steps of the same type without repetition, enhancing readability; And follows the previous keyword's semantics, while But introduces contrast. Background groups common setup steps that apply to all scenarios within a feature, reducing duplication. Advanced keywords extend Gherkin's expressiveness for complex specifications. Scenario Outline (or its synonym Scenario Template) allows parameterization of a scenario template by replacing placeholders like <quantity> with values from an Examples table, enabling multiple executions with varied inputs. For instance:

Scenario Outline: Eating cucumbers Given there are <start> cucumbers When I eat <eat> cucumbers Then I should have <left> cucumbers Examples: | start | eat | left | | 12 | 5 | 7 | | 20 | 5 | 15 |

Scenario Outline: Eating cucumbers Given there are <start> cucumbers When I eat <eat> cucumbers Then I should have <left> cucumbers Examples: | start | eat | left | | 12 | 5 | 7 | | 20 | 5 | 15 |

Tags, prefixed with @, categorize features or scenarios for selective execution or reporting, such as @[smoke](/page/Smoke) for basic functionality tests or @regression for comprehensive suites. Rule organizes related scenarios under a specific , introduced in version 6, to clarify intent without affecting execution. Practical usage often combines these keywords in domain-specific scenarios. A simple login example illustrates the pattern:

Feature: User Authentication [Scenario](/page/Scenario): Successful login Given I am on the login page When I enter valid credentials Then I see the dashboard

Feature: User Authentication [Scenario](/page/Scenario): Successful login Given I am on the login page When I enter valid credentials Then I see the dashboard

This structure promotes a flow while remaining . For parameterized cases, the outline above demonstrates without hardcoding values. Best practices emphasize writing atomic steps that perform a single, focused action to maintain modularity and ease maintenance. Scenarios should avoid implementation details, such as UI elements or database calls, focusing instead on user-centric to ensure longevity across technology changes. For incomplete features, scenarios can be drafted with pending steps, allowing progressive implementation without halting the specification process. Gherkin supports localization in over 70 languages to accommodate international teams, with keywords translated accordingly; for example, in French, Given becomes Étant donné. A language directive like # language: fr at the file's top enables these variations while preserving semantics.

Implementation

Step Definitions

Step definitions in Cucumber serve as the bridge between declarative Gherkin steps and executable code, allowing behavior-driven development tests to perform actual actions or assertions. Each step definition consists of a matching pattern—typically a regular expression or Cucumber Expression—and a bound code block or method that implements the step's logic. When Cucumber processes a Gherkin scenario, it scans for step definitions that match the step's text, ignoring the leading keywords like Given, When, or Then, and executes the corresponding code if a match is found. Implementation varies by programming language but follows a consistent of associating the matcher with executable code. In , step definitions use a with keywords followed by a or expression and a do-end block; for instance:

ruby

Given(/I have (\d+) cukes in my belly/) do |cukes| @cukes = cukes.to_i end

Given(/I have (\d+) cukes in my belly/) do |cukes| @cukes = cukes.to_i end

This matches steps like "I have 48 cukes in my belly" and passes the captured number as an to the block. In Java, annotations from Cucumber-JVM denote the keyword and , linking to a method:

java

import io.cucumber.java.en.Given; @Given("I have {int} cukes in my belly") public void iHaveCukesInMyBelly([Integer](/page/Integer) cukes) { this.cukes = cukes; }

import io.cucumber.java.en.Given; @Given("I have {int} cukes in my belly") public void iHaveCukesInMyBelly([Integer](/page/Integer) cukes) { this.cukes = cukes; }

Here, the {int} parameter type automatically transforms the captured text into an . Similarly, in with Cucumber.js, definitions use functions registered via keywords and string patterns:

javascript

const {Given} = require('@cucumber/cucumber'); Given('I have {int} cukes in my belly', function (cukes) { this.cukes = cukes; });

const {Given} = require('@cucumber/cucumber'); Given('I have {int} cukes in my belly', function (cukes) { this.cukes = cukes; });

The {int} expression captures and type-converts numeric values seamlessly across these languages. Parameters are extracted using capturing groups in the pattern, which map directly to method or block arguments in the order they appear. Basic groups like (\w+) capture strings, while built-in types such as {int} or {word} apply transformations (e.g., converting digits to integers via underlying regex like \d+). For complex inputs, DocStrings—multiline text blocks delimited by triple quotes in Gherkin—are passed as a single String argument to the step definition, enabling handling of embedded content like JSON or error messages. DataTables, tabular data in Gherkin steps, are provided as a specialized DataTable object as the final argument, which can be converted to structures like List<List> for raw access, Map<String, String> for key-value pairs, or custom types via registered transformers, facilitating data-driven testing without hardcoding values. Step definitions can be distributed across multiple files for modularity, with Cucumber automatically loading all definitions from configured directories during test execution, promoting reuse across feature files. To enhance matching flexibility, regular expressions support flags; for example, in Ruby, appending i to the delimiter (e.g., /pattern/i) enables case-insensitivity, while in Java and JavaScript, equivalent options are set via the regex constructor (e.g., Pattern.compile("pattern", Pattern.CASE_INSENSITIVE)). If no step definition matches a Gherkin step, Cucumber generates an "undefined step" , prompting users to implement the missing definition and halting the . Conversely, if a step definition encounters a runtime , such as a failed assertion or unhandled exception during execution, the individual step fails, marking the entire as failed and reporting the exception details in the test output.

Hooks and Configuration

Cucumber hooks provide a mechanism to execute at specific points during the execution lifecycle, primarily for setup and teardown activities. These blocks of run automatically and can be scoped to scenarios, features, or steps, allowing developers to manage application state without embedding such logic directly into step definitions. Hooks enhance maintainability by centralizing common actions like database connections or . The primary hook types include Before and After hooks, which execute immediately before and after a scenario or feature, respectively; Around hooks, available in , which wrap the entire execution of a scenario for precise control over timing; and step-level hooks like BeforeStep and AfterStep, which target individual steps within a scenario. By default, hooks apply to all scenarios unless scoped otherwise, such as limiting to a specific feature file. Tag filtering further refines execution: for instance, a Before hook annotated with "@slow" will only trigger for scenarios tagged with @slow in the Gherkin file, enabling conditional setup based on test categories. Implementation of hooks varies by programming language due to Cucumber's multi-language support. In Ruby, the original language for Cucumber, Before and After hooks use block syntax: Before do |scenario| ... end for pre-scenario actions and After do |scenario| ... end for post-scenario cleanup, where the scenario parameter provides access to details like name and status. Around hooks in Ruby use block syntax to wrap scenario execution. In Java, hooks leverage annotations from the Cucumber JVM library: @Before for setup and @After for teardown, with methods receiving a Scenario object for context. Hook ordering can be controlled in Java via the order attribute, such as @Before(order = 1), ensuring predictable sequence when multiple hooks are defined. Custom formatters can integrate with hooks by attaching data (e.g., screenshots or logs) during After hooks, which then feeds into reporting plugins. Configuration in Cucumber varies by programming language and centralizes settings to avoid repetitive command-line arguments across runs. In Ruby, profiles are defined in a cucumber.yml file, placed in the project root or a config directory, encapsulating options such as output formatters (e.g., --format [json](/page/JSON)), paths to step definition directories (e.g., features/step_definitions), and tag filters to include or exclude scenarios (e.g., tags: ~@wip to skip work-in-progress tests). To activate a profile, specify it via the command line, such as cucumber -p ci. For and other implementations, configuration uses annotations like @CucumberOptions, command-line arguments, environment variables, or build tool profiles (e.g., Maven). Environment variables complement file-based or annotation-based configuration, with Cucumber parsing them alongside system properties and a cucumber.properties file for overrides; for example, setting DRY_RUN=true enables validation of step matching without full execution, useful for syntax checks during development. Advanced configurations support custom parameter types or data table conversions, but these are typically defined programmatically rather than in profiles.

Usage

Command-Line Interface

The (CLI) of Cucumber provides a straightforward way to execute Gherkin feature files directly from the terminal, supporting standalone test runs without embedding in build tools. It accepts paths to feature directories or files as arguments and applies options to control filtering, formatting, and execution behavior. The CLI varies slightly by implementation but shares core options for consistency across languages. Basic usage involves invoking the platform-specific command followed by feature paths. For Ruby, installed via the cucumber gem (gem install cucumber), the command is cucumber features/ or bundle exec cucumber features/my_feature.feature to run all scenarios in a file. In Java (JVM), using the cucumber-core dependency via Maven or Gradle, it is java -cp "classpath" io.cucumber.core.cli.Main features/ --glue stepdefinitions or integrated via mvn test. For JavaScript, installed as @cucumber/cucumber via npm (npm install --save-dev @cucumber/cucumber), the command is npx cucumber-js features/ or ./node_modules/.bin/cucumber-js features/. These invocations load step definitions from specified glue paths and execute matching scenarios. Key options enable customization of runs. The --format (or --plugin) option specifies output formats such as progress for concise console updates, html for browser-readable reports, or json for machine-readable data (e.g., cucumber --format html --out reports/index.html). The --tags option filters scenarios by tags (e.g., cucumber --tags "@smoke and not @slow" to run smoke tests excluding slow ones), allowing selective execution based on metadata defined in features. The --dry-run flag performs a non-executing validation of step definitions against features, highlighting undefined or unused steps without invoking code (e.g., cucumber --dry-run). Additionally, -p or --profile loads predefined configurations from files like cucumber.yml (Ruby) or system properties (Java). Output is directed to console by default, with progress bars or detailed summaries for passed/failed scenarios. Formatted reports are generated in specified directories, such as HTML files in ./reports/ for visual analysis or JSON in ./reports/cucumber.json for CI integration. Console reporting includes color-coded indicators: green for passes, red for failures, and yellow for pending steps. Exit codes indicate run status: 0 for all scenarios passing, 1 for any failures or undefined steps, and 2 for syntax errors or configuration issues. This enables scripting and CI/CD pipelines to react appropriately, such as failing builds on non-zero codes.

Integration with Testing Frameworks

Cucumber-JVM integrates seamlessly with popular Java testing frameworks, enabling automated execution of Gherkin-based tests within established unit testing environments. For JUnit 4, developers add the cucumber-junit dependency to their project and annotate a runner class with @RunWith(Cucumber.class), which discovers and runs feature files as JUnit tests. In JUnit 5, integration occurs via the cucumber-junit-platform-engine dependency and @Suite annotation on a test class, allowing parallel execution through Maven's Surefire plugin or Gradle. Similarly, for TestNG, the cucumber-testng dependency is required, paired with a test class extending AbstractTestNGCucumberTests or using @CucumberOptions, supporting parallel runs by setting the data provider to true in TestNG XML configurations. Build tools facilitate dependency management and test execution for Cucumber-JVM projects. In Maven, core dependencies such as cucumber-java, cucumber-junit (or cucumber-testng), and gherkin are added to the pom.xml file under the test scope, with the Failsafe plugin configured to run Cucumber tests during integration phases like verify. For Gradle, the cucumber-gradle-plugin or direct dependencies are applied in build.gradle, defining a cucumber task that leverages the Java plugin to execute tests alongside JUnit or TestNG runners. In the .NET ecosystem, functionality is provided through SpecFlow, an official companion tool that implements syntax and integrates directly with for test execution. SpecFlow projects include the SpecFlow.NUnit package, enabling feature files to run as test assemblies via attributes like [Binding] for step definitions and 's [TestFixture]. This setup supports parallel execution and reporting within .NET build processes. embeds into pipelines for automated testing and report aggregation. The official Reports plugin for Jenkins parses output from runs, generating visualizations of test results, pass/fail rates, and step details during builds. For GitHub Actions, workflows typically use actions like setup-java to run Maven or commands that execute tests, with artifacts uploaded for reports and optional steps to publish summaries or integrate with external reporting services. Enhanced reporting extensions build on Cucumber's JSON formatter for detailed visualizations. Allure integrates via the allure-cucumber7-jvm adapter, which attaches step traces, screenshots, and metadata to XML results, viewable in interactive dashboards after generation with allure serve. ExtentReports uses the extentreports-cucumber adapter plugin in the runner's @CucumberOptions, producing HTML reports with categorized logs, timelines, and device/system info from Cucumber's execution output.

Ecosystem

Supported Programming Languages

Cucumber provides official implementations in , (through Cucumber-JVM), , and Go, enabling step definitions to be written natively in these languages while maintaining compatibility with the Gherkin syntax. These core runtimes form the foundation for (BDD) testing across diverse environments. Additionally, community-maintained implementations exist for other languages, though they may vary in official endorsement and activity levels. The original Ruby implementation, known as Cucumber-Ruby, serves as the reference for the ecosystem and is highly mature, supporting installation via with commands like gem install cucumber. It is widely used for its simplicity in scripting automated tests and remains actively maintained under since December 2024. Cucumber-JVM is the official implementation, popular in enterprise settings for its robustness and support for multiple JVM languages including , , Scala, and Kotlin. It integrates seamlessly with build tools like Maven and , allowing step definitions to leverage the full power of the Java ecosystem for complex test automation. For and , Cucumber.js provides the official runtime, optimized for environments and browser-based testing. It supports integrations with popular frameworks such as Jest and Mocha, making it suitable for full-stack JavaScript applications and frontend testing scenarios. The Go implementation, godog, is an official port that allows writing step definitions in Go, emphasizing performance and concurrency for systems-level testing. Among other notable implementations, Behat for PHP offers Cucumber-like BDD capabilities, installed via Composer, and is maintained independently but aligns closely with core principles. For Python, Behave serves as an unofficial yet widely adopted alternative, supporting Gherkin features through pip installation, though it is not directly under the Cucumber umbrella. In the .NET ecosystem, Reqnroll (a 2025 fork of the discontinued SpecFlow project) provides support via NuGet packages for Gherkin parsing and integrates with testing frameworks like NUnit and xUnit. It relies on community extensions for full functionality and continues as the primary BDD tool for .NET aligned with Cucumber principles following SpecFlow's end-of-life in December 2024. As of December 2024, all Cucumber implementations have transitioned back to following the end of SmartBear's , resulting in varying maintenance activity across projects— with core ones like and JVM seeing consistent updates, while others depend on contributor engagement.

Plugins and Extensions

Cucumber's ecosystem is enriched by a variety of plugins and extensions developed by the official team and community contributors, which extend its core functionality for improved development workflows, reporting, and specialized testing capabilities. These add-ons integrate seamlessly with Cucumber's Gherkin-based syntax, enabling enhancements such as , automated report generation, and domain-specific testing tools.

IDE Plugins

Integrated Development Environment (IDE) plugins for Cucumber provide essential support for writing and debugging feature files and step definitions. The official Cucumber plugin for IDEs, such as , offers features like , step autocompletion, and navigation between feature files and corresponding step definitions in languages like , , and Scala. Similarly, the Cucumber Eclipse Plugin enhances the IDE with syntax support, step definition linking, and test runner integration for streamlined BDD development. For , the official Cucumber for VSCode extension, maintained by the Cucumber team, delivers syntax highlighting, step suggestion, and scenario outline expansion, compatible with Windows, , and macOS environments. Additional options include Atom packages for Cucumber editing and the TextMate bundle for macOS users seeking lightweight support.

Formatters

Cucumber supports a range of built-in and custom formatters to output test results in formats suitable for (CI) pipelines and analysis tools. Native formatters include for machine-readable outputs, XML/JUnit for compatibility with tools like Jenkins, and for basic web views, all leveraging an event-based API aligned with the Cucumber Messages protocol. For advanced reporting, the Serenity BDD formatter generates layered, narrative-driven reports that include screenshots, , and test coverage details, particularly useful in Java-based projects. Custom and XML formatters can be implemented via plugin classes to integrate with CI systems, ensuring structured data for automated processing.

Utilities

Utilities in the Cucumber ecosystem simplify reporting and extend testing scopes beyond traditional BDD scenarios. Cucumber Reports, an official web-based viewer, allows teams to upload outputs from Cucumber runs (supported in JVM ≥6.7.0, ≥5.1.1, and JS ≥7.0.0) for interactive dashboards displaying pass/fail rates, trends, and feature breakdowns. The cucumber-reporting plugin, a community-maintained Maven/ tool, transforms results into visually enhanced reports with charts and embeddable elements for sharing test outcomes. serves as a prominent utility for , utilizing Cucumber's syntax to script RESTful interactions, mocks, and performance checks in a single framework, effectively extending Cucumber for backend validation without additional step definitions.

Community Contributions

The open-source nature of Cucumber fosters extensive community contributions on GitHub, particularly in reusable libraries for hooks and step definitions. Repositories like cucumber-step-definitions provide pre-built JavaScript hooks for common setup/teardown tasks, such as database resets or logging, reducing boilerplate in Cucumber-JS projects. Step definition generators, such as the VS Code extension by nguyenngoclongdev, automate the creation of boilerplate code from Gherkin steps, supporting multiple output formats and synchronization with feature files. Other contributions include the cucumber-expressions library for parameter type definitions and hook utilities in cucumber-jvm for minimal-ceremony annotations in Java step implementations. These GitHub-hosted tools, often under the cucumber organization or affiliated repos, number in the hundreds and focus on language-specific enhancements. Emerging extensions in 2024-2025 incorporate AI for automating scenario generation, with tools like leveraging generative models to produce Gherkin-compatible BDD scenarios from requirements, improving efficiency in test creation.

References

Add your contribution
Related Hubs
User Avatar
No comments yet.