Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.1k
cucumber/cucumber-js
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Automated tests in plain language, for Node.js
Cucumber is a tool for running automated tests written in plain language. Because they'rewritten in plain language, they can be read by anyone on your team. Because they can beread by anyone, you can use them to help improve communication, collaboration and trust onyour team.
This is the JavaScript implementation of Cucumber. It runs onmaintained versions of Node.js. You canquickly try it via CodeSandbox, or read on to get started locally in a couple of minutes.
Looking to contribute? Read ourcode of conduct first, then check thecontributing guide to get up and running.
Cucumber isavailable on npm:
npm install @cucumber/cucumber
Let's take this example of something to test:
First, write your main code insrc/index.js:
classGreeter{sayHello(){return'hello'}}module.exports={ Greeter}
Then, write your feature infeatures/greeting.feature:
Feature: GreetingScenario: Say helloWhenthe greeter says helloThenI should have heard"hello"
Next, implement your steps infeatures/support/steps.js:
constassert=require('assert')const{ When, Then}=require('@cucumber/cucumber')const{ Greeter}=require('../../src')When('the greeter says hello',function(){this.whatIHeard=newGreeter().sayHello()});Then('I should have heard {string}',function(expectedResponse){assert.equal(this.whatIHeard,expectedResponse)});
Finally, run Cucumber:
npx cucumber-js
And see the output:
If you learn best by example, we havea repo with several example projects, that might help you get going.
The following documentation is formain, which might contain some unreleased features. Seedocumentation for older versions if you need it.
- Installation
- CLI
- Configuration
- Support Code
- Guides
- Debugging
- Dry run
- ES Modules
- Failing fast
- Filtering which scenarios run
- Formatters for feedback and reporting
- Parallel running for speed
- Profiles for composable configuration
- Rerunning just failures
- Retrying flaky scenarios
- JavaScript API for running programmatically
- Snippets for undefined steps
- Transpiling (from TypeScript etc)
- FAQ
Support isavailable from the community if you need it.
About
Cucumber for JavaScript
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
