Description
Cucumber.js is the JavaScript implementation of Cucumber and runs on both Node.js and modern web browsers.
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.
-
Playwright
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API. -
Nightwatch
Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack -
volkswagen
:see_no_evil: Volkswagen detects when your tests are being run in a CI server, and makes them pass. -
istanbul
Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale. -
loadtest
Runs a load test on the selected URL. Fast and easy to use. Can be integrated in your own workflow using the API. -
power-assert
Power Assert in JavaScript. Provides descriptive assertion messages through standard assert interface. No API is the best API. -
testcontainers-node
Testcontainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Cucumber.js or a related project?
README
Cucumber Automated tests in plain language, for Node.js
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.