Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cucumber for JavaScript

License

NotificationsYou must be signed in to change notification settings

cucumber/cucumber-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


Cucumber

Automated tests in plain language, for Node.js

Latest version on npmBuild statusCoverageBackersSponsorsUkraine solidarity

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.

Install

Cucumber isavailable on npm:

npm install @cucumber/cucumber

Get Started

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:

Terminal output showing a successful test run with 1 scenario and 2 steps, all passing

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

Documentation

The following documentation is formain, which might contain some unreleased features. Seedocumentation for older versions if you need it.

Support

Support isavailable from the community if you need it.


[8]ページ先頭

©2009-2025 Movatter.jp