- Notifications
You must be signed in to change notification settings - Fork1.1k
Cucumber for Ruby. It's amazing!
License
cucumber/cucumber-ruby
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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 Ruby implementation of Cucumber. Cucumber is also available forJavaScript,Java, and a lot of other languages. You can find a list of implementations here:https://cucumber.io/docs/installation/.
SeeCONTRIBUTING.md for info on contributing to Cucumber (issues, PRs, etc.).
Everyone interacting in this codebase and issue tracker is expected to follow theCucumbercode of conduct.
Cucumber for Ruby is a Ruby gem. Install it as you would install any gem: addcucumber
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 usingbundle exec
. If this is not the case for you, executecucumber
directly, withoutbundle exec
.
- Ruby 3.2
- Ruby 3.1
- Ruby 3.0
- Ruby 2.7
- TruffleRuby 22.0.0+
- JRuby 9.4+ (withsome limitations)
Using Ruby on Rails? You can usecucumber-rails to bring Cucumber into your Rails project.
If you need to, initialize yourfeatures
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 a file namedrule.feature
in thefeatures
directory with:
# features/rule.featureFeature: Rule Sample Rule: This is a rule Example: A passing exampleGiventhis will passWhenI do an actionThensome results should be there Example: A failing exampleGiventhis will failWhenI do an actionThensome results should be there
And a file namedsteps.rb
infeatures/step_definitions
with:
# features/step_definitions/steps.rbGiven('this will pass')do@this_will_pass=trueendGiven('this will fail')do@this_will_pass=falseendWhen('I do an action')do:no_opendThen("some results should be there")doexpect(@this_will_pass).tobetrueend
$ 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:5
To summarize the results on the standard output, and generate 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 infeatures/docs/cli.
- Getting started, writing features, step definitions, and more:https://cucumber.io/docs
- Ruby API Documentation:http://www.rubydoc.info/github/cucumber/cucumber-ruby/
- Community support forum:https://github.com/orgs/cucumber/discussions
- Discord:register for an account
Copyright (c) Cucumber Ltd. and Contributors. See LICENSE for details.
About
Cucumber for Ruby. It's amazing!