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

cucumber/cucumber-ruby: Cucumber for Ruby. It's amazing!

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

开源软件名称(OpenSource Name):

cucumber/cucumber-ruby

开源软件地址(OpenSource Url):

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

开源编程语言(OpenSource Language):

Ruby 72.4%

开源软件介绍(OpenSource Introduction):

Cucumber Open - Supported by Smartbear

Cucumber

Stand With Ukraine OpenCollective OpenCollective pull requests issues Test cucumber Code Climate Coverage Status

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.

Cucumber Gherkin Example

This is the Ruby implementation of Cucumber. Cucumber is also available for JavaScript, Java, and a lot of other languages. You can find a list of implementations here: https://cucumber.io/docs/installation/.

See CONTRIBUTING.md for info on contributing to Cucumber (issues, PRs, etc.).

Everyone interacting in this codebase and issue tracker is expected to follow the Cucumber code of conduct.

Installation

Cucumber for Ruby is a Ruby gem. Install it as you would install any gem: add cucumber to your Gemfile:

gem 'cucumber'

then install it:

$ bundle

or install the gem directly:

$ gem install cucumber

Later in this document, bundler is considered being used so all commands are using bundle exec. If this is not the case for you, execute cucumber directly, without bundle exec.

Supported platforms

  • Ruby 3.1
  • Ruby 3.0
  • Ruby 2.7
  • Ruby 2.6
  • TruffleRuby 22.0.0+
  • JRuby (with some limitations)
    • 9.3 >= 9.3.1 (there is a known issue with JRuby 9.3.0. More info can be found in the PR#1571.)

Ruby on Rails

Using Ruby on Rails? You can use cucumber-rails to bring Cucumber into your Rails project.

Usage

Initialization

If you need to, initialize your features directory with

$ bundle exec cucumber --init

This will create the following directories and files if they do not exist already:

features
├── step_definitions
└── support
    └── env.rb

Create your specification

Create a file named rule.feature in the features directory with:

# features/rule.feature

Feature: Rule Sample

  Rule: This is a rule

    Example: A passing example
      Given this will pass
      When I do an action
      Then some results should be there

    Example: A failing example
      Given this will fail
      When I do an action
      Then some results should be there

Automate your specification

And a file named steps.rb in features/step_definitions with:

# features/step_definitions/steps.rb

Given("this will pass") do
  @this_will_pass = true
end

Given("this will fail") do
  @this_will_pass = false
end

When("I do an action") do
end

Then("some results should be there") do
  expect(@this_will_pass)
end

Run Cucumber

$ bundle exec cucumber

To execute a single feature file:

$ bundle exec cucumber features/rule.feature

To execute a single example, indicates the line of the name of the example:

$ bundle exec cucumber features/rule.feature:7

To summarize the results on the standard output, and writte a HTML report on disk:

$ bundle exec cucumber --format summary --format html --out report.html

For more command line options

$ bundle exec cucumber --help

You can also find documentation on the command line possibilities in features/docs/cli.

Documentation and support

Copyright

Copyright (c) Cucumber Ltd. and Contributors. See LICENSE for details.




鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
sharjeelyunus/hacktoberfest发布时间:2022-06-17
下一篇:
mattjegan/awesome-hacktoberfest: An Awesome List of Awesome Hacktoberfest-Relate ...发布时间:2022-06-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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