Giter Site home page Giter Site logo

colineberhardt / cucumber-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cucumber/cucumber-js

0.0 2.0 0.0 26.71 MB

Cucumber for JavaScript

Home Page: https://cucumber.io

License: MIT License

Shell 0.29% JavaScript 0.40% Awk 0.05% TypeScript 76.51% Makefile 0.12% Gherkin 22.62%

cucumber-js's Introduction


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.

cucumber-js's People

Contributors

jbpros avatar renovate[bot] avatar charlierudolph avatar davidjgoss avatar aslakhellesoy avatar mattwynne avatar aurelien-reeves avatar kevgo avatar simondean avatar vincent-psarga avatar izhaki avatar samccone avatar honzajavorek avatar zs-zs avatar vincentcapicotto avatar tooky avatar marketionist avatar darrinholst avatar mjhm avatar shivamsanju avatar jshifflet avatar gd46 avatar nicojs avatar olivoil avatar zearin avatar dependabot[bot] avatar mend-for-github-com[bot] avatar lgandecki avatar eddiefletchernz avatar jan-molak avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.