cucumber 6.0.0 → 8.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +371 -168
- data/CONTRIBUTING.md +216 -55
- data/README.md +139 -21
- data/lib/autotest/cucumber_mixin.rb +5 -2
- data/lib/autotest/discover.rb +3 -2
- data/lib/cucumber/cli/configuration.rb +4 -1
- data/lib/cucumber/cli/main.rb +4 -3
- data/lib/cucumber/cli/options.rb +14 -4
- data/lib/cucumber/cli/profile_loader.rb +1 -5
- data/lib/cucumber/cli/rerun_file.rb +1 -1
- data/lib/cucumber/configuration.rb +5 -4
- data/lib/cucumber/constantize.rb +1 -1
- data/lib/cucumber/deprecate.rb +2 -1
- data/lib/cucumber/errors.rb +1 -1
- data/lib/cucumber/events/hook_test_step_created.rb +1 -2
- data/lib/cucumber/events/step_activated.rb +0 -6
- data/lib/cucumber/events/step_definition_registered.rb +0 -5
- data/lib/cucumber/events/test_case_created.rb +1 -2
- data/lib/cucumber/events/test_run_finished.rb +2 -1
- data/lib/cucumber/events/test_step_created.rb +1 -2
- data/lib/cucumber/events/undefined_parameter_type.rb +1 -2
- data/lib/cucumber/events.rb +2 -2
- data/lib/cucumber/file_specs.rb +2 -1
- data/lib/cucumber/filters/activate_steps.rb +1 -0
- data/lib/cucumber/filters/tag_limits/verifier.rb +1 -3
- data/lib/cucumber/filters/tag_limits.rb +1 -3
- data/lib/cucumber/formatter/ansicolor.rb +63 -70
- data/lib/cucumber/formatter/ast_lookup.rb +2 -2
- data/lib/cucumber/formatter/backtrace_filter.rb +1 -1
- data/lib/cucumber/formatter/console.rb +20 -4
- data/lib/cucumber/formatter/console_issues.rb +6 -1
- data/lib/cucumber/formatter/duration_extractor.rb +1 -0
- data/lib/cucumber/formatter/errors.rb +1 -0
- data/lib/cucumber/formatter/fanout.rb +1 -1
- data/lib/cucumber/formatter/http_io.rb +6 -1
- data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -1
- data/lib/cucumber/formatter/io.rb +3 -1
- data/lib/cucumber/formatter/json.rb +32 -26
- data/lib/cucumber/formatter/junit.rb +6 -3
- data/lib/cucumber/formatter/message.rb +2 -1
- data/lib/cucumber/formatter/message_builder.rb +11 -10
- data/lib/cucumber/formatter/pretty.rb +34 -23
- data/lib/cucumber/formatter/progress.rb +1 -0
- data/lib/cucumber/formatter/publish_banner_printer.rb +1 -1
- data/lib/cucumber/formatter/query/hook_by_test_step.rb +1 -0
- data/lib/cucumber/formatter/query/test_case_started_by_test_case.rb +2 -0
- data/lib/cucumber/formatter/rerun.rb +2 -0
- data/lib/cucumber/formatter/steps.rb +5 -2
- data/lib/cucumber/formatter/summary.rb +1 -0
- data/lib/cucumber/formatter/unicode.rb +4 -4
- data/lib/cucumber/formatter/usage.rb +9 -7
- data/lib/cucumber/gherkin/data_table_parser.rb +2 -1
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +2 -2
- data/lib/cucumber/gherkin/steps_parser.rb +1 -1
- data/lib/cucumber/glue/dsl.rb +19 -5
- data/lib/cucumber/glue/hook.rb +2 -1
- data/lib/cucumber/glue/invoke_in_world.rb +4 -4
- data/lib/cucumber/glue/proto_world.rb +12 -9
- data/lib/cucumber/glue/registry_and_more.rb +20 -5
- data/lib/cucumber/glue/registry_wrapper.rb +31 -0
- data/lib/cucumber/glue/step_definition.rb +9 -7
- data/lib/cucumber/hooks.rb +1 -0
- data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +2 -1
- data/lib/cucumber/multiline_argument/data_table.rb +58 -71
- data/lib/cucumber/platform.rb +2 -2
- data/lib/cucumber/rake/task.rb +10 -7
- data/lib/cucumber/rspec/disable_option_parser.rb +6 -3
- data/lib/cucumber/running_test_case.rb +1 -0
- data/lib/cucumber/runtime/meta_message_builder.rb +106 -0
- data/lib/cucumber/runtime/support_code.rb +3 -0
- data/lib/cucumber/runtime/user_interface.rb +5 -4
- data/lib/cucumber/runtime.rb +42 -23
- data/lib/cucumber/step_match.rb +6 -10
- data/lib/cucumber/step_match_search.rb +3 -2
- data/lib/cucumber/term/ansicolor.rb +74 -50
- data/lib/cucumber/term/banner.rb +1 -0
- data/lib/cucumber/version +1 -1
- data/lib/cucumber.rb +2 -1
- data/lib/simplecov_setup.rb +1 -1
- metadata +90 -89
- data/lib/cucumber/core_ext/string.rb +0 -11
data/CONTRIBUTING.md
CHANGED
@@ -1,85 +1,246 @@
|
|
1
|
-
|
1
|
+
# Contributing to Cucumber
|
2
2
|
|
3
|
-
|
3
|
+
Thank you for considering contributing to Cucumber!
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
* Reporting a bug? Please tell us:
|
8
|
-
* which version of Cucumber you're using
|
9
|
-
* which version of Ruby you're using.
|
10
|
-
* How to reproduce it. Bugs with a failing test in a [pull request](https://help.github.com/articles/using-pull-requests) get fixed much quicker. Some bugs may never be fixed.
|
11
|
-
* Want to paste some code or output? Put \`\`\` on a line above and below your code/output. See [GFM](https://help.github.com/articles/github-flavored-markdown)'s *Fenced Code Blocks* for details.
|
12
|
-
* We love [pull requests](https://help.github.com/articles/using-pull-requests). But if you don't have a test to go with it we probably won't merge it.
|
5
|
+
This document will first introduce different ways to get involved before
|
6
|
+
focusing on how to contribute to the code.
|
13
7
|
|
14
|
-
|
8
|
+
## Code of Conduct
|
9
|
+
|
10
|
+
Everyone interacting in this codebase and issue tracker is expected to follow
|
11
|
+
the Cucumber [code of conduct](https://cucumber.io/conduct).
|
12
|
+
|
13
|
+
## How can I contribute?
|
14
|
+
|
15
|
+
If you're reading this, you are certainly looking to contribute to the code. Cucumber
|
16
|
+
is not this single repository. It is made up of several packages around several
|
17
|
+
repositories. So before going further with the code, you may consider the
|
18
|
+
following first, in order to get your bearings.
|
19
|
+
|
20
|
+
If you just want to know how to contribute to the code, go to
|
21
|
+
[Contribute to the code](#contribute-to-the-code).
|
22
|
+
|
23
|
+
If you want to report an issue, or suggest an enhancement, go to
|
24
|
+
[Report bugs and submit feature requests](#report-bugs-and-submit-feature-requests).
|
25
|
+
|
26
|
+
### Meet the community, the maintainers, and other Cucumber developers
|
27
|
+
|
28
|
+
Smartbear hosts a [community message board].
|
29
|
+
This is a good place to meet users, the community, and to ask questions.
|
30
|
+
|
31
|
+
You can also join the Cucumber Community Slack:
|
32
|
+
[register for an account][register-slack] then head over to [#intro][slack-intro].
|
33
|
+
This is the place to be to meet other contributors and find a mentor to help you
|
34
|
+
get started.
|
35
|
+
|
36
|
+
### Test Cucumber
|
37
|
+
|
38
|
+
Testing Cucumber, especially new features, is a great way to contribute. We
|
39
|
+
cannot put a price on (early) feedback.
|
40
|
+
|
41
|
+
Keep an eye on our CHANGELOGS to discover new features. Test and experiment, and
|
42
|
+
submit your feedback through [issues](#report-bugs-and-submit-feature-requests),
|
43
|
+
the [community message board], or [Slack][community-slack].
|
44
|
+
|
45
|
+
### Contribute to the documentation
|
46
|
+
|
47
|
+
[The documentation][cucumber-docs] is an important part of Cucumber. It is
|
48
|
+
essential that it remains simple and accurate. You can contribute to it via
|
49
|
+
[github.com/cucumber/docs](https://github.com/cucumber/docs).
|
50
|
+
|
51
|
+
### Promote Cucumber
|
52
|
+
|
53
|
+
You don't know how to contribute but would like to help? Telling other people
|
54
|
+
about Cucumber on the Internet - social media, reviews, blogs - but also in real
|
55
|
+
life is already a big help! Join us on [Slack][community-slack] to share your
|
56
|
+
publication and to discover new ones.
|
57
|
+
|
58
|
+
## Report bugs and submit feature requests
|
59
|
+
|
60
|
+
The short version is:
|
61
|
+
|
62
|
+
- Find the appropriate repository
|
63
|
+
- Try to check there is not already an issue or pull request that deals with
|
64
|
+
your bug or request
|
65
|
+
- Explain your issue and include as much details as possible to help other
|
66
|
+
people reproduce your problem or understand your request
|
67
|
+
- Consider submitting a pull request if you feel confident enough
|
68
|
+
|
69
|
+
You can find more details for each of these steps in the following sections.
|
70
|
+
|
71
|
+
### Find the appropriate repository
|
72
|
+
|
73
|
+
The current repository, `cucumber-ruby`, is actually the tip of the iceberg. It
|
74
|
+
provides a user interface through a CLI, some built-in formatters, and the
|
75
|
+
execution environment you may know as the `World` object.
|
76
|
+
|
77
|
+
An important repository is [cucumber/common]. It is a mono-repo
|
78
|
+
with a lot of libraries. You will find there what is related to:
|
79
|
+
|
80
|
+
- parsing Gherkin documents - aka `.feature` files
|
81
|
+
- parsing tag expressions - the options you use to filter an execution with tags
|
82
|
+
- parsing Cucumber expressions - the expressions that link a Gherkin step to a
|
83
|
+
step definition
|
84
|
+
- everyting related to the HTML formatter
|
85
|
+
|
86
|
+
`cucumber-ruby` is also composed of [cucumber-ruby-core]: this is the engine that
|
87
|
+
will execute the test cases computed from a parsed Gherkin document
|
88
|
+
|
89
|
+
Last but not least, there is also a repository for [cucumber-rails], the gem
|
90
|
+
that brings Cucumber to Rails 5.x and 6.x.
|
15
91
|
|
16
|
-
|
92
|
+
In any case, if your are not sure, best places to open an issue are the current
|
93
|
+
repository - `cucumber-ruby` - and the mono-repo at [cucumber/common].
|
17
94
|
|
18
|
-
|
95
|
+
### Look for existing issues and pull requests
|
19
96
|
|
20
|
-
|
97
|
+
Search in [the current repository][cucumber-ruby-issues], in the
|
98
|
+
[mono-repo][cucumber/common-issues], but also in the
|
99
|
+
[whole cucumber organization][cucumber-issues] if the problem or feature has already
|
100
|
+
been reported. If you find an issue or pull request which is still open, add
|
101
|
+
comments to it instead of opening a new one.
|
21
102
|
|
22
|
-
|
103
|
+
If you're not sure, don't hesitate to just open a new issue. We can always merge
|
104
|
+
and de-duplicate later.
|
23
105
|
|
24
|
-
|
25
|
-
Execute `bundle config set --local gemfile Gemfile.local` to use it per default.
|
106
|
+
### Submitting a pull request
|
26
107
|
|
27
|
-
|
108
|
+
When submitting a pull request:
|
109
|
+
|
110
|
+
- create a [draft pull request][how-to-create-a-draft-pr]
|
111
|
+
- try to follow the instructions in the [template](.github/PULL_REQUEST_TEMPLATE.md)
|
112
|
+
- if possible, [sign your commits]
|
113
|
+
- update CHANGELOG.md with your changes
|
114
|
+
- once the PR is ready, request for reviews
|
115
|
+
|
116
|
+
More info on [how to contribute to the code](#contribute-to-the-code) can be
|
117
|
+
found below.
|
118
|
+
|
119
|
+
### Opening a new issue
|
120
|
+
|
121
|
+
To open a good issue, be clear and precise.
|
122
|
+
|
123
|
+
If you report a problem, the reader must be able to reproduce it easily.
|
124
|
+
Please do your best to create a [minimal, reproducible example][minimal-reproducible-example].
|
125
|
+
|
126
|
+
Consider submitting a pull request. Even if you think you cannot fix it by
|
127
|
+
yourself, a pull request with a failing test is always welcome.
|
128
|
+
|
129
|
+
If you request is for an enhancement - a new feature - try to be specific and
|
130
|
+
support your request with referenced facts and include examples to illustrate
|
131
|
+
your proposal.
|
132
|
+
|
133
|
+
## Contribute to the code
|
134
|
+
|
135
|
+
### Development environment
|
136
|
+
|
137
|
+
Development environment for `cucumber-ruby` is a simple Ruby environment with
|
138
|
+
Bundler. Use a [supported Ruby version](./README.md#supported-platforms), make
|
139
|
+
sure [Bundler] is set-up, and voilà!
|
140
|
+
|
141
|
+
You can then [fork][how-to-fork] and clone the repository. If your environment
|
142
|
+
is set-up properly, the following commands should install the dependencies and
|
143
|
+
execute all the tests successfully.
|
144
|
+
|
145
|
+
```shell
|
146
|
+
bundle install
|
147
|
+
bundle exec rake
|
148
|
+
```
|
149
|
+
|
150
|
+
You can now create a branch for your changes and [submit a pull request](#submitting-a-pull-request)!
|
151
|
+
|
152
|
+
If you want to check the code coverage during your development, execute
|
153
|
+
`bundle exec rake cov`.
|
154
|
+
|
155
|
+
### Cucumber-ruby-core
|
156
|
+
|
157
|
+
As seen here: [Find the appropriate repository](#find-the-appropriate-repository),
|
158
|
+
you may need to work with other repositories in order to accomplish your
|
159
|
+
development. Beside the mono-repo in [cucumber/common], [cucumber-ruby-core] is
|
160
|
+
also a big piece of `cucumber-ruby`.
|
161
|
+
|
162
|
+
### Using a local Gemfile
|
163
|
+
|
164
|
+
A local Gemfile allows you to use your prefer set of gems for your own
|
165
|
+
development workflow, like gems dedicated to debugging. Such gems are not part
|
166
|
+
of `cucumber-ruby` standard `Gemfile`.
|
167
|
+
|
168
|
+
`Gemfile.local`, `Gemfile.local.lock` and `.bundle` have been added to
|
169
|
+
`.gitignore` so local changes cannot be accidentaly commited and pushed to the
|
170
|
+
repository.
|
171
|
+
|
172
|
+
A `Gemfile.local` may look like this:
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
# Gemfile.local
|
28
176
|
|
29
|
-
~~~ruby
|
30
177
|
# Include the regular Gemfile
|
31
178
|
eval File.read('Gemfile')
|
32
179
|
|
180
|
+
# Include your favorites development gems
|
33
181
|
group :development do
|
34
182
|
gem 'byebug'
|
35
|
-
gem 'debase', require: false
|
36
|
-
gem 'ruby-debug-ide', require: false
|
37
183
|
gem 'pry'
|
38
184
|
gem 'pry-byebug'
|
39
|
-
end
|
40
|
-
~~~
|
41
185
|
|
42
|
-
|
186
|
+
gem 'debase', require: false
|
187
|
+
gem 'ruby-debug-ide', require: false
|
188
|
+
end
|
189
|
+
```
|
190
|
+
|
191
|
+
Then you can execute bundler with the `--gemfile` flag:
|
192
|
+
`bundle install --gemfile Gemfile.local`, or with an environment variable:
|
193
|
+
`BUNDLE_GEMFILE=Gemfile.local bundle [COMMAND]`.
|
194
|
+
|
195
|
+
To use your local Gemfile per default, you can also execute
|
196
|
+
`bundle config set --local gemfile Gemfile.local`.
|
43
197
|
|
44
|
-
|
45
|
-
[docs/vscode-example-launch-configuration.md](https://github.com/cucumber/cucumber-ruby/blob/master/docs/vscode-example-launch-configuration.md)
|
198
|
+
### First timer? Welcome!
|
46
199
|
|
47
|
-
|
200
|
+
Looking for something simple to begin with? Look at issues with the label
|
201
|
+
'[good first issue](https://github.com/cucumber/cucumber-ruby/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)'.
|
48
202
|
|
49
|
-
|
50
|
-
|
51
|
-
* Make sure your patch is well covered by tests. We don't accept changes to Cucumber that aren't tested.
|
52
|
-
* Please do not change the Rakefile, version, or history.
|
53
|
-
(if you want to have your own version, that is fine but
|
54
|
-
bump version in a commit by itself so we can ignore when we merge your change)
|
55
|
-
* Send us a pull request.
|
203
|
+
Remember: Cucumber is more than `cucumber-ruby`. You can look for good first
|
204
|
+
issues in [other cucumber reporistories](#find-the-appropriate-repository).
|
56
205
|
|
57
|
-
|
206
|
+
### Having trouble getting started with the code? We're here to help!
|
58
207
|
|
59
|
-
|
60
|
-
|
61
|
-
|
208
|
+
If you have trouble setting-up your development environment, or getting started
|
209
|
+
with the code, you can join us on [Slack][community-slack]. You will find there
|
210
|
+
a lot of contributors.
|
62
211
|
|
63
|
-
|
212
|
+
Full-time maintainers are also available. We would be please to have 1:1 pairing
|
213
|
+
sessions to help you getting started. Look for
|
214
|
+
[Matt Wynne](https://cucumberbdd.slack.com/team/U590XDLF3) or
|
215
|
+
[Aurélien Reeves](https://cucumberbdd.slack.com/team/U011BB95MC7) on
|
216
|
+
[Slack][community-slack].
|
64
217
|
|
65
|
-
|
218
|
+
### Additional documentation and notice
|
66
219
|
|
67
|
-
|
68
|
-
|
69
|
-
help us to correct style violations reported here:
|
70
|
-
[.rubocop_todo.yml](https://github.com/cucumber/cucumber-ruby/blob/master/.rubocop_todo.yml).
|
220
|
+
You can find additional documentation in the [docs](./docs) directory such as
|
221
|
+
(non-exhaustive list):
|
71
222
|
|
72
|
-
|
223
|
+
- [How to release cucumber-ruby](./docs/RELEASE_PROCESS.md) (for maintainers)
|
224
|
+
- [How to set-up a launch.json configuration for Visual Studio Code](./docs/vscode-example-launch-configuration.md)
|
73
225
|
|
74
|
-
* Upgrade gems with `scripts/update-gemspec`
|
75
|
-
* Bump the version number in `lib/cucumber/version`
|
76
|
-
* Update `CHANGELOG.md` with the upcoming version number and create a new `In Git` section
|
77
|
-
* Remove empty sections from `CHANGELOG.md`
|
78
|
-
* Now release it:
|
79
226
|
|
80
|
-
|
81
|
-
git commit -am "Release X.Y.Z"
|
82
|
-
make release
|
83
|
-
```
|
227
|
+
<!-- Links -->
|
84
228
|
|
85
|
-
|
229
|
+
[community message board]: https://community.smartbear.com/t5/Cucumber-Open/bd-p/CucumberOS
|
230
|
+
[register-slack]: https://cucumberbdd-slack-invite.herokuapp.com/
|
231
|
+
[slack-intro]: https://cucumberbdd.slack.com/messages/C5WD8SA21/
|
232
|
+
[community-slack]: https://cucumberbdd.slack.com/
|
233
|
+
[cucumber-docs]: https://cucumber.io/docs/cucumber
|
234
|
+
[cucumber/common]: https://github.com/cucumber/common
|
235
|
+
[cucumber-ruby-core]: https://github.com/cucumber/cucumber-ruby-core
|
236
|
+
[cucumber-rails]: https://github.com/cucumber/cucumber-rails
|
237
|
+
[cucumber-ruby-issues]: https://github.com/cucumber/cucumber-ruby/search?q=is%3Aissue
|
238
|
+
[cucumber/common-issues]: https://github.com/cucumber/common/search?q=is%3Aissue
|
239
|
+
[cucumber-issues]: https://github.com/search?q=is%3Aissue+user%3Acucumber
|
240
|
+
[how-to-create-a-draft-pr]: https://docs.github.com/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests
|
241
|
+
[how-to-fork]: https://docs.github.com/github/collaborating-with-pull-requests/working-with-forks/about-forks
|
242
|
+
[sign your commits]: https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/signing-commits
|
243
|
+
[minimal-reproducible-example]: https://stackoverflow.com/help/minimal-reproducible-example
|
244
|
+
[RVM]: https://rvm.io/
|
245
|
+
[rbenv]: https://github.com/rbenv/rbenv
|
246
|
+
[Bundler]: https://bundler.io/
|
data/README.md
CHANGED
@@ -1,40 +1,158 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<img src="./.github/img/cucumber-open-logo.png" alt="Cucumber Open - Supported by Smartbear" width="428" />
|
3
|
+
</p>
|
4
|
+
|
5
|
+
# Cucumber
|
6
|
+
|
1
7
|
[![OpenCollective](https://opencollective.com/cucumber/backers/badge.svg)](https://opencollective.com/cucumber)
|
2
8
|
[![OpenCollective](https://opencollective.com/cucumber/sponsors/badge.svg)](https://opencollective.com/cucumber)
|
3
9
|
[![pull requests](https://oselvar.com/api/badge?label=pull%20requests&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-ruby%2FpullRequests.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby)
|
4
10
|
[![issues](https://oselvar.com/api/badge?label=issues&csvUrl=https%3A%2F%2Fraw.githubusercontent.com%2Fcucumber%2Foselvar-github-metrics%2Fmain%2Fdata%2Fcucumber%2Fcucumber-ruby%2Fissues.csv)](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby)
|
5
|
-
[![
|
11
|
+
[![Test cucumber](https://github.com/cucumber/cucumber-ruby/actions/workflows/cucumber-ruby.yml/badge.svg)](https://github.com/cucumber/cucumber-ruby/actions/workflows/cucumber-ruby.yml)
|
6
12
|
[![Code Climate](https://codeclimate.com/github/cucumber/cucumber-ruby.svg)](https://codeclimate.com/github/cucumber/cucumber-ruby)
|
7
|
-
[![Coverage Status](https://coveralls.io/repos/cucumber/cucumber-ruby/badge.svg?branch=
|
8
|
-
|
9
|
-
# Cucumber
|
13
|
+
[![Coverage Status](https://coveralls.io/repos/cucumber/cucumber-ruby/badge.svg?branch=main)](https://coveralls.io/r/cucumber/cucumber-ruby?branch=main)
|
10
14
|
|
11
15
|
Cucumber is a tool for running automated tests written in plain language. Because they're
|
12
16
|
written in plain language, they can be read by anyone on your team. Because they can be
|
13
17
|
read by anyone, you can use them to help improve communication, collaboration and trust on
|
14
18
|
your team.
|
15
19
|
|
16
|
-
|
20
|
+
<p align="center">
|
21
|
+
<img src="./.github/img/gherkin-example.png" alt="Cucumber Gherkin Example" width="728" />
|
22
|
+
</p>
|
23
|
+
|
24
|
+
This is the Ruby implementation of Cucumber. Cucumber is also available for [JavaScript](https://github.com/cucumber/cucumber-js),
|
25
|
+
[Java](https://github.com/cucumber/cucumber-jvm), and a lot of other languages. You can find a list of implementations here: https://cucumber.io/docs/installation/.
|
26
|
+
|
27
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for info on contributing to Cucumber (issues, PRs, etc.).
|
28
|
+
|
29
|
+
Everyone interacting in this codebase and issue tracker is expected to follow the
|
30
|
+
Cucumber [code of conduct](https://cucumber.io/conduct).
|
31
|
+
|
32
|
+
## Installation
|
33
|
+
|
34
|
+
Cucumber for Ruby is a Ruby gem. Install it as you would install any gem: add
|
35
|
+
`cucumber` to your Gemfile:
|
36
|
+
|
37
|
+
gem 'cucumber'
|
38
|
+
|
39
|
+
then install it:
|
40
|
+
|
41
|
+
$ bundle
|
42
|
+
|
43
|
+
or install the gem directly:
|
44
|
+
|
45
|
+
$ gem install cucumber
|
46
|
+
|
47
|
+
Later in this document, bundler is considered being used so all commands are using
|
48
|
+
`bundle exec`. If this is not the case for you, execute `cucumber` directly, without
|
49
|
+
`bundle exec`.
|
50
|
+
|
51
|
+
### Supported platforms
|
52
|
+
|
53
|
+
- Ruby 3.1
|
54
|
+
- Ruby 3.0
|
55
|
+
- Ruby 2.7
|
56
|
+
- Ruby 2.6
|
57
|
+
- JRuby (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md))
|
58
|
+
- 9.3 >= 9.3.1 (there is a known issue with JRuby 9.3.0. More info can
|
59
|
+
be found in the [PR#1571](https://github.com/cucumber/cucumber-ruby/pull/1571).)
|
60
|
+
|
61
|
+
### Ruby on Rails
|
62
|
+
|
63
|
+
Using Ruby on Rails? You can use [cucumber-rails](https://github.com/cucumber/cucumber-rails)
|
64
|
+
to bring Cucumber into your Rails project.
|
65
|
+
|
66
|
+
## Usage
|
67
|
+
|
68
|
+
### Initialization
|
69
|
+
|
70
|
+
If you need to, initialize your `features` directory with
|
71
|
+
|
72
|
+
$ bundle exec cucumber --init
|
73
|
+
|
74
|
+
This will create the following directories and files if they do not exist already:
|
75
|
+
|
76
|
+
features
|
77
|
+
├── step_definitions
|
78
|
+
└── support
|
79
|
+
└── env.rb
|
80
|
+
|
81
|
+
### Create your specification
|
82
|
+
|
83
|
+
Create a file named `rule.feature` in the `features` directory with:
|
84
|
+
|
85
|
+
```gherkin
|
86
|
+
# features/rule.feature
|
87
|
+
|
88
|
+
Feature: Rule Sample
|
89
|
+
|
90
|
+
Rule: This is a rule
|
91
|
+
|
92
|
+
Example: A passing example
|
93
|
+
Given this will pass
|
94
|
+
When I do an action
|
95
|
+
Then some results should be there
|
96
|
+
|
97
|
+
Example: A failing example
|
98
|
+
Given this will fail
|
99
|
+
When I do an action
|
100
|
+
Then some results should be there
|
101
|
+
|
102
|
+
```
|
103
|
+
|
104
|
+
### Automate your specification
|
105
|
+
|
106
|
+
And a file named `steps.rb` in `features/step_definitions` with:
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
# features/step_definitions/steps.rb
|
110
|
+
|
111
|
+
Given("this will pass") do
|
112
|
+
@this_will_pass = true
|
113
|
+
end
|
114
|
+
|
115
|
+
Given("this will fail") do
|
116
|
+
@this_will_pass = false
|
117
|
+
end
|
118
|
+
|
119
|
+
When("I do an action") do
|
120
|
+
end
|
121
|
+
|
122
|
+
Then("some results should be there") do
|
123
|
+
expect(@this_will_pass)
|
124
|
+
end
|
125
|
+
```
|
126
|
+
|
127
|
+
### Run Cucumber
|
128
|
+
|
129
|
+
$ bundle exec cucumber
|
130
|
+
|
131
|
+
To execute a single feature file:
|
132
|
+
|
133
|
+
$ bundle exec cucumber features/rule.feature
|
134
|
+
|
135
|
+
To execute a single example, indicates the line of the name of the example:
|
136
|
+
|
137
|
+
$ bundle exec cucumber features/rule.feature:7
|
138
|
+
|
139
|
+
To summarize the results on the standard output, and writte a HTML report on disk:
|
140
|
+
|
141
|
+
$ bundle exec cucumber --format summary --format html --out report.html
|
17
142
|
|
18
|
-
|
19
|
-
* Documentation: https://cucumber.io/docs
|
20
|
-
* Ruby API Documentation: http://www.rubydoc.info/github/cucumber/cucumber-ruby/
|
21
|
-
* Support forum: https://groups.google.com/group/cukes
|
22
|
-
* Chat: ([Slack](https://cucumber.io/support#slack) and [Gitter](https://cucumber.io/support#gitter))
|
143
|
+
For more command line options
|
23
144
|
|
24
|
-
|
145
|
+
$ bundle exec cucumber --help
|
25
146
|
|
26
|
-
|
27
|
-
|
28
|
-
* Ruby 2.7
|
29
|
-
* Ruby 2.6
|
30
|
-
* Ruby 2.5
|
31
|
-
* Ruby 2.4
|
32
|
-
* Ruby 2.3
|
33
|
-
* JRuby 9.2 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/master/docs/jruby-limitations.md))
|
147
|
+
You can also find documentation on the command line possibilities in
|
148
|
+
[features/docs/cli](features/docs/cli).
|
34
149
|
|
35
|
-
##
|
150
|
+
## Documentation and support
|
36
151
|
|
37
|
-
|
152
|
+
- Getting started, writing features, step definitions, and more: https://cucumber.io/docs
|
153
|
+
- Ruby API Documentation: http://www.rubydoc.info/github/cucumber/cucumber-ruby/
|
154
|
+
- Community support forum: https://community.smartbear.com/t5/Cucumber-Open/bd-p/CucumberOS
|
155
|
+
- Slack: [register for an account](https://cucumberbdd-slack-invite.herokuapp.com/) then head over to [#intro](https://cucumberbdd.slack.com/messages/C5WD8SA21/)
|
38
156
|
|
39
157
|
## Copyright
|
40
158
|
|
@@ -24,7 +24,7 @@ module Autotest::CucumberMixin
|
|
24
24
|
add_sigint_handler
|
25
25
|
|
26
26
|
loop do # ^c handler
|
27
|
-
|
27
|
+
wait_for_green
|
28
28
|
if tainted
|
29
29
|
rerun_all_tests
|
30
30
|
rerun_all_features if all_good
|
@@ -37,6 +37,7 @@ module Autotest::CucumberMixin
|
|
37
37
|
reset_features
|
38
38
|
rescue Interrupt
|
39
39
|
break if wants_to_quit
|
40
|
+
|
40
41
|
reset
|
41
42
|
reset_features
|
42
43
|
end
|
@@ -47,7 +48,7 @@ module Autotest::CucumberMixin
|
|
47
48
|
features_to_run == ''
|
48
49
|
end
|
49
50
|
|
50
|
-
def
|
51
|
+
def wait_for_green
|
51
52
|
loop do
|
52
53
|
super
|
53
54
|
run_features
|
@@ -70,6 +71,7 @@ module Autotest::CucumberMixin
|
|
70
71
|
Tempfile.open('autotest-cucumber') do |dirty_features_file|
|
71
72
|
cmd = make_cucumber_cmd(features_to_run, dirty_features_file.path)
|
72
73
|
break if cmd.empty?
|
74
|
+
|
73
75
|
old_sync = $stdout.sync
|
74
76
|
$stdout.sync = true
|
75
77
|
self.results = []
|
@@ -81,6 +83,7 @@ module Autotest::CucumberMixin
|
|
81
83
|
print(c)
|
82
84
|
line << c
|
83
85
|
next unless c == "\n"
|
86
|
+
|
84
87
|
results << line.join
|
85
88
|
line.clear
|
86
89
|
end
|
data/lib/autotest/discover.rb
CHANGED
@@ -2,9 +2,10 @@
|
|
2
2
|
|
3
3
|
Autotest.add_discovery do
|
4
4
|
if File.directory?('features')
|
5
|
-
|
5
|
+
case ENV['AUTOFEATURE']
|
6
|
+
when /true/i
|
6
7
|
'cucumber'
|
7
|
-
|
8
|
+
when /false/i
|
8
9
|
# noop
|
9
10
|
else
|
10
11
|
puts '(Not running features. To run features in autotest, set AUTOFEATURE=true.)'
|
@@ -9,7 +9,9 @@ require 'cucumber'
|
|
9
9
|
module Cucumber
|
10
10
|
module Cli
|
11
11
|
class YmlLoadError < StandardError; end
|
12
|
+
|
12
13
|
class ProfilesNotDefinedError < YmlLoadError; end
|
14
|
+
|
13
15
|
class ProfileNotFound < StandardError; end
|
14
16
|
|
15
17
|
class Configuration
|
@@ -17,7 +19,7 @@ module Cucumber
|
|
17
19
|
|
18
20
|
attr_reader :out_stream
|
19
21
|
|
20
|
-
def initialize(out_stream =
|
22
|
+
def initialize(out_stream = $stdout, error_stream = $stderr)
|
21
23
|
@out_stream = out_stream
|
22
24
|
@error_stream = error_stream
|
23
25
|
@options = Options.new(@out_stream, @error_stream, default_profile: 'default')
|
@@ -28,6 +30,7 @@ module Cucumber
|
|
28
30
|
@options.parse!(args)
|
29
31
|
arrange_formats
|
30
32
|
raise("You can't use both --strict and --wip") if strict.strict? && wip?
|
33
|
+
|
31
34
|
set_environment_variables
|
32
35
|
end
|
33
36
|
|
data/lib/cucumber/cli/main.rb
CHANGED
@@ -14,7 +14,7 @@ module Cucumber
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def initialize(args,
|
17
|
+
def initialize(args, out = $stdout, err = $stderr, kernel = Kernel)
|
18
18
|
@args = args
|
19
19
|
@out = out
|
20
20
|
@err = err
|
@@ -41,7 +41,7 @@ module Cucumber
|
|
41
41
|
@err.puts("Couldn't open #{e.path}")
|
42
42
|
exit_unable_to_finish
|
43
43
|
rescue FeatureFolderNotFoundException => e
|
44
|
-
@err.puts(e.message
|
44
|
+
@err.puts("#{e.message}. You can use `cucumber --init` to get started.")
|
45
45
|
exit_unable_to_finish
|
46
46
|
rescue ProfilesNotDefinedError, YmlLoadError, ProfileNotFound => e
|
47
47
|
@err.puts(e.message)
|
@@ -85,13 +85,14 @@ module Cucumber
|
|
85
85
|
trap('INT') do
|
86
86
|
exit_unable_to_finish! if Cucumber.wants_to_quit
|
87
87
|
Cucumber.wants_to_quit = true
|
88
|
-
|
88
|
+
$stderr.puts "\nExiting... Interrupt again to exit immediately."
|
89
89
|
exit_unable_to_finish
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
def runtime(existing_runtime)
|
94
94
|
return Runtime.new(configuration) unless existing_runtime
|
95
|
+
|
95
96
|
existing_runtime.configure(configuration)
|
96
97
|
existing_runtime
|
97
98
|
end
|