• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

cucumber/cucumber-js: Cucumber for JavaScript

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

cucumber/cucumber-js

开源软件地址:

https://github.com/cucumber/cucumber-js

开源编程语言:

TypeScript 76.5%

开源软件介绍:


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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
actions/javascript-action: Create a JavaScript Action with tests, linting, workf ...发布时间:2022-06-24
下一篇:
daniellidg/javascript-knowhow发布时间:2022-06-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap