cucumber 5.3.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1357 -1102
- data/CONTRIBUTING.md +40 -28
- data/README.md +17 -14
- data/lib/cucumber/cli/options.rb +5 -1
- data/lib/cucumber/formatter/backtrace_filter.rb +1 -0
- data/lib/cucumber/formatter/json.rb +25 -24
- data/lib/cucumber/glue/proto_world.rb +15 -31
- data/lib/cucumber/glue/registry_and_more.rb +1 -1
- data/lib/cucumber/runtime.rb +6 -1
- data/lib/cucumber/step_match.rb +1 -7
- data/lib/cucumber/version +1 -1
- metadata +88 -68
data/CONTRIBUTING.md
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
We appreciate that. But before you do, please learn our basic rules:
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
- This is not a support forum. If you have a question, please go to [The Cukes Google Group](http://groups.google.com/group/cukes).
|
6
|
+
- Do you have an idea for a new feature? Then don't expect it to be implemented unless you or someone else sends a [pull request](https://help.github.com/articles/using-pull-requests). You might be better to start a discussion on [the google group](http://groups.google.com/group/cukes).
|
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.
|
13
13
|
|
14
14
|
# Contributing to Cucumber
|
15
15
|
|
@@ -21,26 +21,38 @@ You can chat with the core team on https://gitter.im/cucumber/contributors. We t
|
|
21
21
|
|
22
22
|
## Installing your own gems
|
23
23
|
|
24
|
-
A `Gemfile.local`-file can be used to have your own gems installed to support
|
25
|
-
|
24
|
+
A `Gemfile.local`-file can be used to have your own gems installed to support your normal development workflow.
|
25
|
+
Execute `bundle config set --local gemfile Gemfile.local` to use it per default.
|
26
26
|
|
27
27
|
Example:
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
```ruby
|
30
|
+
# Include the regular Gemfile
|
31
|
+
eval File.read('Gemfile')
|
32
|
+
|
33
|
+
group :development do
|
34
|
+
gem 'byebug'
|
35
|
+
gem 'debase', require: false
|
36
|
+
gem 'ruby-debug-ide', require: false
|
37
|
+
gem 'pry'
|
38
|
+
gem 'pry-byebug'
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
## Using Visual Studio Code?
|
43
|
+
|
44
|
+
Sample for launch.json configuration is available in
|
45
|
+
[docs/vscode-example-launch-configuration.md](https://github.com/cucumber/cucumber-ruby/blob/main/docs/vscode-example-launch-configuration.md)
|
34
46
|
|
35
47
|
## Note on Patches/Pull Requests
|
36
48
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
49
|
+
- Fork the project. Make a branch for your change.
|
50
|
+
- Make your feature addition or bug fix.
|
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.
|
41
53
|
(if you want to have your own version, that is fine but
|
42
54
|
bump version in a commit by itself so we can ignore when we merge your change)
|
43
|
-
|
55
|
+
- Send us a pull request.
|
44
56
|
|
45
57
|
## Running tests
|
46
58
|
|
@@ -50,24 +62,24 @@ gem 'byebug'
|
|
50
62
|
|
51
63
|
To get code coverage results, run `bundle exec rake cov`
|
52
64
|
|
53
|
-
## First timer?
|
65
|
+
## First timer? Welcome!
|
54
66
|
|
55
67
|
If you are new to the project or to OSS, check the label
|
56
68
|
[Easy](https://github.com/cucumber/cucumber-ruby/labels/Easy). Also, you can
|
57
69
|
help us to correct style violations reported here:
|
58
|
-
[.rubocop_todo.yml](https://github.com/cucumber/cucumber-ruby/blob/
|
70
|
+
[.rubocop_todo.yml](https://github.com/cucumber/cucumber-ruby/blob/main/.rubocop_todo.yml).
|
59
71
|
|
60
72
|
## Release Process
|
61
73
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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:
|
67
79
|
|
68
80
|
```
|
69
81
|
git commit -am "Release X.Y.Z"
|
70
82
|
make release
|
71
83
|
```
|
72
84
|
|
73
|
-
|
85
|
+
- Finally, update the cucumber-ruby version in the [documentation project](https://cucumber.io/docs/installation/) in [versions.yaml](https://github.com/cucumber/docs/blob/master/data/versions.yaml) file.
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
[](https://opencollective.com/cucumber)
|
2
2
|
[](https://opencollective.com/cucumber)
|
3
|
-
|
3
|
+
[](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby)
|
4
|
+
[](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby)
|
4
5
|
[](https://circleci.com/gh/cucumber/cucumber-ruby)
|
5
|
-
|
6
6
|
[](https://codeclimate.com/github/cucumber/cucumber-ruby)
|
7
|
-
[](https://coveralls.io/r/cucumber/cucumber-ruby?branch=main)
|
8
8
|
|
9
9
|
# Cucumber
|
10
10
|
|
@@ -15,24 +15,27 @@ your team.
|
|
15
15
|
|
16
16
|
Where to get more info:
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
- The main website: https://cucumber.io/
|
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))
|
23
23
|
|
24
24
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for info on contributing to Cucumber.
|
25
25
|
|
26
26
|
## Supported platforms
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
|
28
|
+
- Ruby 3.0
|
29
|
+
- Ruby 2.7
|
30
|
+
- Ruby 2.6
|
31
|
+
- Ruby 2.5
|
32
|
+
- Ruby 2.4
|
33
|
+
- Ruby 2.3
|
34
|
+
- JRuby 9.2 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md))
|
32
35
|
|
33
36
|
## Code of Conduct
|
34
37
|
|
35
|
-
Everyone interacting in this codebase and issue tracker is expected to follow the Cucumber [code of conduct](https://
|
38
|
+
Everyone interacting in this codebase and issue tracker is expected to follow the Cucumber [code of conduct](https://cucumber.io/conduct).
|
36
39
|
|
37
40
|
## Copyright
|
38
41
|
|
data/lib/cucumber/cli/options.rb
CHANGED
@@ -24,7 +24,11 @@ module Cucumber
|
|
24
24
|
"#{INDENT}the usage formatter, except that steps are not printed."],
|
25
25
|
'junit' => ['Cucumber::Formatter::Junit', "Generates a report similar to Ant+JUnit. Use\n" \
|
26
26
|
"#{INDENT}junit,fileattribute=true to include a file attribute."],
|
27
|
-
'json' => ['Cucumber::Formatter::Json',
|
27
|
+
'json' => ['Cucumber::Formatter::Json', "Prints the feature as JSON.\n" \
|
28
|
+
"#{INDENT}The JSON format is in maintenance mode.\n" \
|
29
|
+
"#{INDENT}Please consider using the message formatter\n"\
|
30
|
+
"#{INDENT}with the standalone json-formatter\n" \
|
31
|
+
"#{INDENT}(https://github.com/cucumber/cucumber/tree/master/json-formatter)."],
|
28
32
|
'message' => ['Cucumber::Formatter::Message', 'Outputs protobuf messages'],
|
29
33
|
'html' => ['Cucumber::Formatter::HTML', 'Outputs HTML report'],
|
30
34
|
'summary' => ['Cucumber::Formatter::Summary', 'Summary output of feature and scenarios']
|
@@ -5,7 +5,6 @@ require 'base64'
|
|
5
5
|
require 'cucumber/formatter/backtrace_filter'
|
6
6
|
require 'cucumber/formatter/io'
|
7
7
|
require 'cucumber/formatter/ast_lookup'
|
8
|
-
require 'cucumber/deprecate'
|
9
8
|
|
10
9
|
module Cucumber
|
11
10
|
module Formatter
|
@@ -14,14 +13,6 @@ module Cucumber
|
|
14
13
|
include Io
|
15
14
|
|
16
15
|
def initialize(config)
|
17
|
-
Cucumber::Deprecate::CliOption.deprecate(
|
18
|
-
config.error_stream,
|
19
|
-
'--format=json',
|
20
|
-
"Please use --format=message and stand-alone json-formatter.\n" \
|
21
|
-
'json-formatter homepage: https://github.com/cucumber/cucumber/tree/master/json-formatter#cucumber-json-formatter',
|
22
|
-
'6.0.0'
|
23
|
-
)
|
24
|
-
|
25
16
|
@io = ensure_io(config.out_stream, config.error_stream)
|
26
17
|
@ast_lookup = AstLookup.new(config)
|
27
18
|
@feature_hashes = []
|
@@ -41,21 +32,23 @@ module Cucumber
|
|
41
32
|
@feature_hashes << @feature_hash
|
42
33
|
end
|
43
34
|
@test_case_hash = builder.test_case_hash
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
@in_background = false
|
50
|
-
feature_elements << @test_case_hash
|
51
|
-
@element_hash = @test_case_hash
|
52
|
-
end
|
35
|
+
|
36
|
+
@element_hash = nil
|
37
|
+
@element_background_hash = builder.background_hash
|
38
|
+
@in_background = builder.background?
|
39
|
+
|
53
40
|
@any_step_failed = false
|
54
41
|
end
|
55
42
|
|
56
43
|
def on_test_step_started(event)
|
57
44
|
test_step = event.test_step
|
58
45
|
return if internal_hook?(test_step)
|
46
|
+
|
47
|
+
if @element_hash.nil?
|
48
|
+
@element_hash = create_element_hash(test_step)
|
49
|
+
feature_elements << @element_hash
|
50
|
+
end
|
51
|
+
|
59
52
|
if test_step.hook?
|
60
53
|
@step_or_hook_hash = {}
|
61
54
|
hooks_of_type(test_step) << @step_or_hook_hash
|
@@ -80,6 +73,8 @@ module Cucumber
|
|
80
73
|
end
|
81
74
|
|
82
75
|
def on_test_case_finished(event)
|
76
|
+
feature_elements << @test_case_hash if @in_background
|
77
|
+
|
83
78
|
_test_case, result = *event.attributes
|
84
79
|
result = result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
|
85
80
|
add_failed_around_hook(result) if result.failed? && !@any_step_failed
|
@@ -94,10 +89,7 @@ module Cucumber
|
|
94
89
|
test_step_output << src
|
95
90
|
return
|
96
91
|
end
|
97
|
-
if
|
98
|
-
content = File.open(src, 'rb', &:read)
|
99
|
-
data = encode64(content)
|
100
|
-
elsif mime_type =~ /;base64$/
|
92
|
+
if mime_type =~ /;base64$/
|
101
93
|
mime_type = mime_type[0..-8]
|
102
94
|
data = src
|
103
95
|
else
|
@@ -169,6 +161,13 @@ module Cucumber
|
|
169
161
|
@step_or_hook_hash[:embeddings] ||= []
|
170
162
|
end
|
171
163
|
|
164
|
+
def create_element_hash(test_step)
|
165
|
+
return @element_background_hash if @in_background && !first_step_after_background?(test_step)
|
166
|
+
|
167
|
+
@in_background = false
|
168
|
+
@test_case_hash
|
169
|
+
end
|
170
|
+
|
172
171
|
def create_step_hash(test_step)
|
173
172
|
step_source = @ast_lookup.step_source(test_step).step
|
174
173
|
step_hash = {
|
@@ -269,7 +268,8 @@ module Cucumber
|
|
269
268
|
name: background.name,
|
270
269
|
description: value_or_empty_string(background.description),
|
271
270
|
line: background.location.line,
|
272
|
-
type: 'background'
|
271
|
+
type: 'background',
|
272
|
+
steps: []
|
273
273
|
}
|
274
274
|
end
|
275
275
|
|
@@ -281,7 +281,8 @@ module Cucumber
|
|
281
281
|
name: test_case.name,
|
282
282
|
description: value_or_empty_string(scenario.description),
|
283
283
|
line: test_case.location.lines.max,
|
284
|
-
type: 'scenario'
|
284
|
+
type: 'scenario',
|
285
|
+
steps: []
|
285
286
|
}
|
286
287
|
@test_case_hash[:tags] = create_tags_array_from_tags_array(test_case.tags) unless test_case.tags.empty?
|
287
288
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'cucumber/gherkin/formatter/ansi_escapes'
|
4
4
|
require 'cucumber/core/test/data_table'
|
5
5
|
require 'cucumber/deprecate'
|
6
|
+
require 'mime/types'
|
6
7
|
|
7
8
|
module Cucumber
|
8
9
|
module Glue
|
@@ -72,46 +73,29 @@ module Cucumber
|
|
72
73
|
MultilineArgument::DataTable.from(text_or_table)
|
73
74
|
end
|
74
75
|
|
75
|
-
# Print a message to the output.
|
76
|
-
#
|
77
|
-
# @note Cucumber might surprise you with the behaviour of this method. Instead
|
78
|
-
# of sending the output directly to STDOUT, Cucumber will intercept and cache
|
79
|
-
# the message until the current step has finished, and then display it.
|
80
|
-
#
|
81
|
-
# If you'd prefer to see the message immediately, call {Kernel.puts} instead.
|
82
|
-
def puts(*messages)
|
83
|
-
Cucumber.deprecate(
|
84
|
-
'Messages emitted with "puts" will no longer be caught by Cucumber ' \
|
85
|
-
'and sent to the formatter. If you want message to be in the formatted output, ' \
|
86
|
-
"please use log(message) instead.\n" \
|
87
|
-
'If you simply want it in the console, '\
|
88
|
-
'keep using "puts" (or Kernel.puts to avoid this message)',
|
89
|
-
'puts(message)',
|
90
|
-
'6.0.0'
|
91
|
-
)
|
92
|
-
messages.each { |message| log(message.to_s) }
|
93
|
-
end
|
94
|
-
|
95
76
|
# Pause the tests and ask the operator for input
|
96
77
|
def ask(question, timeout_seconds = 60)
|
97
78
|
super
|
98
79
|
end
|
99
80
|
|
100
|
-
# Embed an image in the output
|
101
|
-
def embed(file, mime_type, _label = 'Screenshot')
|
102
|
-
Cucumber.deprecate(
|
103
|
-
'Please use attach(file, media_type) instead',
|
104
|
-
'embed(file, mime_type, label)',
|
105
|
-
'6.0.0'
|
106
|
-
)
|
107
|
-
attach(file, mime_type)
|
108
|
-
end
|
109
|
-
|
110
81
|
def log(*messages)
|
111
82
|
messages.each { |message| attach(message.to_s.dup, 'text/x.cucumber.log+plain') }
|
112
83
|
end
|
113
84
|
|
114
|
-
|
85
|
+
# Attach a file to the output
|
86
|
+
# @param file [string|io] the file to attach.
|
87
|
+
# It can be a string containing the file content itself,
|
88
|
+
# the file path, or an IO ready to be read.
|
89
|
+
# @param media_type [string] the media type. If file is a valid path,
|
90
|
+
# media_type can be ommitted, it will then be inferred from the file name.
|
91
|
+
def attach(file, media_type = nil)
|
92
|
+
return super unless File.file?(file)
|
93
|
+
|
94
|
+
content = File.read(file, mode: 'rb')
|
95
|
+
media_type = MIME::Types.type_for(file).first if media_type.nil?
|
96
|
+
|
97
|
+
super(content, media_type.to_s)
|
98
|
+
rescue StandardError
|
115
99
|
super
|
116
100
|
end
|
117
101
|
|
@@ -91,7 +91,7 @@ module Cucumber
|
|
91
91
|
step_definition
|
92
92
|
rescue Cucumber::CucumberExpressions::UndefinedParameterTypeError => e
|
93
93
|
# TODO: add a way to extract the parameter type directly from the error.
|
94
|
-
type_name = e.message.match(/^Undefined parameter type
|
94
|
+
type_name = e.message.match(/^Undefined parameter type ['|\{](.*)['|\}].?$/)[1]
|
95
95
|
|
96
96
|
@configuration.notify :undefined_parameter_type, type_name, string_or_regexp
|
97
97
|
end
|
data/lib/cucumber/runtime.rb
CHANGED
@@ -235,12 +235,17 @@ module Cucumber
|
|
235
235
|
step_match_search = StepMatchSearch.new(@support_code.registry.method(:step_matches), @configuration)
|
236
236
|
filters << Filters::ActivateSteps.new(step_match_search, @configuration)
|
237
237
|
@configuration.filters.each { |filter| filters << filter }
|
238
|
+
|
238
239
|
unless configuration.dry_run?
|
239
240
|
filters << Filters::ApplyAfterStepHooks.new(@support_code)
|
240
241
|
filters << Filters::ApplyBeforeHooks.new(@support_code)
|
241
242
|
filters << Filters::ApplyAfterHooks.new(@support_code)
|
242
243
|
filters << Filters::ApplyAroundHooks.new(@support_code)
|
243
|
-
|
244
|
+
end
|
245
|
+
|
246
|
+
filters << Filters::BroadcastTestCaseReadyEvent.new(@configuration)
|
247
|
+
|
248
|
+
unless configuration.dry_run?
|
244
249
|
filters << Filters::BroadcastTestRunStartedEvent.new(@configuration)
|
245
250
|
filters << Filters::Quit.new
|
246
251
|
filters << Filters::Retry.new(@configuration)
|
data/lib/cucumber/step_match.rb
CHANGED
@@ -28,7 +28,7 @@ module Cucumber
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def invoke(multiline_arg)
|
31
|
-
all_args =
|
31
|
+
all_args = args
|
32
32
|
multiline_arg.append_to(all_args)
|
33
33
|
@step_definition.invoke(all_args)
|
34
34
|
end
|
@@ -93,12 +93,6 @@ module Cucumber
|
|
93
93
|
def inspect #:nodoc:
|
94
94
|
"#<#{self.class}: #{location}>"
|
95
95
|
end
|
96
|
-
|
97
|
-
private
|
98
|
-
|
99
|
-
def deep_clone_args
|
100
|
-
Marshal.load(Marshal.dump(args))
|
101
|
-
end
|
102
96
|
end
|
103
97
|
|
104
98
|
class SkippingStepMatch
|
data/lib/cucumber/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
6.1.0
|