Popularity
7.9
Stable
Activity
8.1
Declining
4,975
220
1,085

Description

Cucumber.js is the JavaScript implementation of Cucumber and runs on both Node.js and modern web browsers.

Code Quality Rank: L5
Monthly Downloads: 0
Programming language: TypeScript
License: MIT License
Tags: Testing     BDD     Cucumber     Tests     Human-readable     Gherkin    
Latest version: v8.9.0

Cucumber.js alternatives and similar modules

Based on the "Testing" category.
Alternatively, view Cucumber.js alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Cucumber.js or a related project?

Add another 'Testing' Module

README

Cucumber Automated tests in plain language, for Node.js

#StandWithUkraine npm build coverage backers sponsors pull requests issues

Cucumber is a tool for running automated tests written in plain language. Because they're written in plain language, they can be read by anyone on your team. Because they can be read by anyone, you can use them to help improve communication, collaboration and trust on your team.

This is the JavaScript implementation of Cucumber. It runs on maintained versions of Node.js. You can quickly try it via CodeSandbox, or read on to get started locally in a couple of minutes.

Looking to contribute? Read our code of conduct first, then check the [contributing guide](./CONTRIBUTING.md) to get up and running.

Install

Cucumber is available on npm:

$ npm install @cucumber/cucumber

Get Started

Let's take this example of something to test:

class Greeter {
  sayHello() {
    return 'hello'
  }
}

First, write your feature in features/greeting.feature:

Feature: Greeting

  Scenario: Say hello
    When the greeter says hello
    Then I should have heard "hello"

Next, implement your steps in features/support/steps.js:

const assert = require('assert')
const { When, Then } = require('@cucumber/cucumber')
const { Greeter } = require('../../src')

When('the greeter says hello', function () {
  this.whatIHeard = new Greeter().sayHello()
});

Then('I should have heard {string}', function (expectedResponse) {
  assert.equal(this.whatIHeard, expectedResponse)
});

Finally, run Cucumber:

$ npx cucumber-js

And see the output:

[Terminal output showing a successful test run with 1 scenario and 2 steps, all passing](./docs/images/readme-output.png)

If you learn best by example, we have a repo with several example projects, that might help you get going.

Documentation

The following documentation is for main, which might contain some unreleased features. See [documentation for older versions](./docs/older_versions.md) if you need it.

  • [Installation](./docs/installation.md)
  • [CLI](./docs/cli.md)
  • [Configuration](./docs/configuration.md)
  • Support Code
    • [API Reference](./docs/support_files/api_reference.md)
    • [Attachments](./docs/support_files/attachments.md)
    • [Data Tables](./docs/support_files/data_table_interface.md)
    • [Hooks](./docs/support_files/hooks.md)
    • [Step Definitions](./docs/support_files/step_definitions.md)
    • [Timeouts](./docs/support_files/timeouts.md)
    • [World](./docs/support_files/world.md)
  • Guides
    • [Debugging](./docs/debugging.md)
    • [Dry run](./docs/dry_run.md)
    • [ES Modules](./docs/esm.md)
    • [Failing fast](./docs/fail_fast.md)
    • [Filtering which scenarios run](./docs/filtering.md)
    • [Formatters for feedback and reporting](./docs/formatters.md)
    • [Parallel running for speed](./docs/parallel.md)
    • [Profiles for composable configuration](./docs/profiles.md)
    • [Rerunning just failures](./docs/rerun.md)
    • [Retrying flaky scenarios](./docs/retry.md)
    • [Snippets for undefined steps](./docs/snippets.md)
    • [Transpiling (from TypeScript etc)](./docs/transpiling.md)
  • [FAQ](./docs/faq.md)

Support

Support is available from the community if you need it.