Skip to content

LEJA3/cucumber-js

This branch is 310 commits behind cucumber/cucumber-js:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

fb3144e · Jul 19, 2022
Jul 19, 2022
Mar 21, 2022
Apr 22, 2022
Apr 20, 2022
Jul 19, 2022
Jul 19, 2022
Mar 21, 2022
Jan 3, 2021
Jul 19, 2022
Jun 21, 2022
May 5, 2022
Mar 18, 2020
Oct 2, 2019
Mar 3, 2022
Oct 10, 2021
Dec 17, 2021
Jul 17, 2021
Dec 1, 2020
Jan 15, 2022
Jul 19, 2022
Mar 17, 2022
May 26, 2016
Sep 14, 2020
Jul 19, 2022
Nov 3, 2021
Jun 6, 2022
Mar 17, 2022
Mar 15, 2022
Apr 20, 2022
Jul 19, 2022
Jul 19, 2022
Sep 3, 2021
Sep 18, 2021
Dec 28, 2019

Repository files navigation


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 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

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 if you need it.

Support

Support is available from the community if you need it.

About

Cucumber for JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 76.3%
  • Gherkin 22.8%
  • Other 0.9%