cucumber-core 9.0.1 → 10.1.1
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 +33 -1
- data/CONTRIBUTING.md +182 -9
- data/README.md +72 -67
- data/lib/cucumber/core/test/result.rb +22 -15
- data/lib/cucumber/core/test/timer.rb +2 -2
- data/lib/cucumber/core/version.rb +1 -1
- data/spec/cucumber/core/test/case_spec.rb +19 -21
- data/spec/cucumber/core/test/filters/locations_filter_spec.rb +2 -2
- data/spec/cucumber/core/test/result_spec.rb +6 -6
- metadata +33 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d28116d7a57602d84409608413da13e92d4793db2aa35d5afefb4cd4434a1359
|
4
|
+
data.tar.gz: 3f6c77d8561055c1dd1693b5d5e2fc6467aa8030b9f06335e43b6ab3732e2bbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 299ba7480beafee776b473b376ccc3c39099bca5c5492362d3384edbb66388b9415e80e9c6c3040a2f4cc37150b6320258437b268b6759085f2651f1338546be
|
7
|
+
data.tar.gz: 243a558c0e6bdcbd87705e74f4a28085625f908c600f732b1e72c3a2818b451ea48db7f721f7193535cd8745ebcd40b6ff2185e4acfc34502f0255af4db1e162
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) on how to contribute to Cucumber.
|
2
2
|
|
3
|
-
## [
|
3
|
+
## [Unreleased]
|
4
4
|
|
5
5
|
### Added
|
6
6
|
|
@@ -14,6 +14,35 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
|
|
14
14
|
|
15
15
|
### Dependencies
|
16
16
|
|
17
|
+
## [10.1.1](https://github.com/cucumber/cucumber-ruby-core/compare/v10.1.0...v10.1.1)
|
18
|
+
|
19
|
+
### Dependencies
|
20
|
+
|
21
|
+
* Patched `cucumber-tag-expressions`
|
22
|
+
|
23
|
+
## [10.1.0](https://github.com/cucumber/cucumber-ruby-core/compare/v10.0.1...v10.1.0)
|
24
|
+
|
25
|
+
### Dependencies
|
26
|
+
|
27
|
+
* Patched `cucumber-gherkin`, `cucumber-messages` and `cucumber-tag-expressions`
|
28
|
+
|
29
|
+
## [10.0.1](https://github.com/cucumber/cucumber-ruby-core/compare/v10.0.0...v10.0.1)
|
30
|
+
|
31
|
+
### Dependencies
|
32
|
+
|
33
|
+
* Patched `cucumber-gherkin` and `cucumber-messages`
|
34
|
+
|
35
|
+
## [10.0.0](https://github.com/cucumber/cucumber-ruby-core/compare/v9.0.1...v10.0.0)
|
36
|
+
|
37
|
+
### Dependencies
|
38
|
+
|
39
|
+
* Upgraded to gherkin v20 and messages v17.
|
40
|
+
|
41
|
+
This removes protocol buffers from the runtime dependencies.
|
42
|
+
|
43
|
+
This deeply impacts the API as the internal representation of messages has changed from
|
44
|
+
Protocol Buffer objects to new auto-generated DTOs.
|
45
|
+
|
17
46
|
## [9.0.1](https://github.com/cucumber/cucumber-ruby-core/compare/v9.0.0...v9.0.1)
|
18
47
|
|
19
48
|
### Fixed
|
@@ -325,3 +354,6 @@ Changes were not logged.
|
|
325
354
|
## [1.0.0.beta.2](https://github.com/cucumber/cucumber-ruby-core/compare/v1.0.0.beta.1...v1.0.0.beta.2)
|
326
355
|
|
327
356
|
Changes were not logged.
|
357
|
+
|
358
|
+
|
359
|
+
[Unreleased]: https://github.com/cucumber/cucumber-ruby-core/compare/v10.1.1...main
|
data/CONTRIBUTING.md
CHANGED
@@ -1,13 +1,186 @@
|
|
1
|
-
|
2
|
-
===============
|
1
|
+
# Contributing to Cucumber Ruby Core
|
3
2
|
|
4
|
-
|
5
|
-
* Bump the version number in `lib/cucumber/core/version.rb`
|
6
|
-
* Update `CHANGELOG.md` with the upcoming version number and create a new `In Git` section
|
7
|
-
* Remove empty sections from `CHANGELOG.md`
|
8
|
-
* Now release it:
|
3
|
+
Thank you for considering contributing to Cucumber!
|
9
4
|
|
5
|
+
If you are not sure your contribution is related to `cucumber-ruby-core`, please
|
6
|
+
consider taking a look at [`cucumber-ruby`'s CONTRIBUTING.md](https://github.com/cucumber/cucumber-ruby/blob/main/CONTRIBUTING.md) first.
|
7
|
+
|
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 just want to know how to contribute to the code of `cucumber-ruby-core`,
|
16
|
+
go to [Contribute to the code](#contribute-to-the-code).
|
17
|
+
|
18
|
+
## Report bugs and submit feature requests
|
19
|
+
|
20
|
+
The short version is:
|
21
|
+
|
22
|
+
- Try to check there is not already an issue or pull request that deals with
|
23
|
+
your bug or request
|
24
|
+
- Explain your issue and include as much details as possible to help other
|
25
|
+
people reproduce your problem or understand your request
|
26
|
+
- Consider submitting a pull request if you feel confident enough
|
27
|
+
|
28
|
+
You can find more details for each of these steps in the following sections.
|
29
|
+
|
30
|
+
### Look for existing issues and pull requests
|
31
|
+
|
32
|
+
Search in [the current repository][cucumber-ruby-core-issues], in the
|
33
|
+
[mono-repo][cucumber/common-issues], but also in the
|
34
|
+
[whole cucumber organization][cucumber-issues] if the problem or feature has already
|
35
|
+
been reported. If you find an issue or pull request which is still open, add
|
36
|
+
comments to it instead of opening a new one.
|
37
|
+
|
38
|
+
If you're not sure, don't hesitate to just open a new issue. We can always merge
|
39
|
+
and de-duplicate later.
|
40
|
+
|
41
|
+
### Submitting a pull request
|
42
|
+
|
43
|
+
When submitting a pull request:
|
44
|
+
|
45
|
+
- create a [draft pull request][how-to-create-a-draft-pr]
|
46
|
+
- try to follow the instructions in the [template](.github/PULL_REQUEST_TEMPLATE.md)
|
47
|
+
- if possible, [sign your commits]
|
48
|
+
- update CHANGELOG.md with your changes
|
49
|
+
- once the PR is ready, request for reviews
|
50
|
+
|
51
|
+
More info on [how to contribute to the code](#contribute-to-the-code) can be
|
52
|
+
found below.
|
53
|
+
|
54
|
+
### Opening a new issue
|
55
|
+
|
56
|
+
To open a good issue, be clear and precise.
|
57
|
+
|
58
|
+
If you report a problem, the reader must be able to reproduce it easily.
|
59
|
+
Please do your best to create a [minimal, reproducible example][minimal-reproducible-example].
|
60
|
+
|
61
|
+
Consider submitting a pull request. Even if you think you cannot fix it by
|
62
|
+
yourself, a pull request with a failing test is always welcome.
|
63
|
+
|
64
|
+
If your request is for an enhancement - a new feature - try to be specific and
|
65
|
+
support your request with referenced facts and include examples to illustrate
|
66
|
+
your proposal.
|
67
|
+
|
68
|
+
## Contribute to the code
|
69
|
+
|
70
|
+
### Development environment
|
71
|
+
|
72
|
+
Development environment for `cucumber-ruby-core` is a simple Ruby environment with
|
73
|
+
Bundler. Use a [supported Ruby version](./README.md#supported-platforms), make
|
74
|
+
sure [Bundler] is set-up, and voilà!
|
75
|
+
|
76
|
+
You can then [fork][how-to-fork] and clone the repository. If your environment
|
77
|
+
is set-up properly, the following commands should install the dependencies and
|
78
|
+
execute all the tests successfully.
|
79
|
+
|
80
|
+
```shell
|
81
|
+
bundle install
|
82
|
+
bundle exec rake
|
10
83
|
```
|
11
|
-
|
12
|
-
|
84
|
+
|
85
|
+
You can now create a branch for your changes and [submit a pull request](#submitting-a-pull-request)!
|
86
|
+
|
87
|
+
### Working with local cucumber dependencies
|
88
|
+
|
89
|
+
You may need to use local dependencies instead of released gems for `cucumber-gherkin`
|
90
|
+
or `cucumber-messages`. To do so the [`Gemfile`](./Gemfile) for `cucumber-core`
|
91
|
+
allows you to specify a local path for your gems using environment variables:
|
92
|
+
|
93
|
+
CUCUMBER_GHERKIN_RUBY
|
94
|
+
CUCUMBER_MESSAGES_RUBY
|
95
|
+
|
96
|
+
For example, the following would use a local version of `cucumber-gherkin` with
|
97
|
+
the `rake` command:
|
98
|
+
|
99
|
+
```shell
|
100
|
+
CUCUMBER_GHERKIN_RUBY=../common/gherkin/ruby bundle exec rake
|
13
101
|
```
|
102
|
+
|
103
|
+
In the same way, if you want to test your changes to `cucumber-core` with a local
|
104
|
+
`cucumber-ruby`, checkout [`cucumber-ruby`][cucumber-ruby] and do your tests with
|
105
|
+
`CUCUMBER_RUBY_CORE` pointing to your local `cucumber-core`:
|
106
|
+
|
107
|
+
```shell
|
108
|
+
~/cucumber-ruby-core> cd ../cucumber-ruby
|
109
|
+
~/cucumber-ruby> CUCUMBER_RUBY_CORE=../cucumber-ruby-core bundle exec rake
|
110
|
+
```
|
111
|
+
|
112
|
+
### Using a local Gemfile
|
113
|
+
|
114
|
+
A local Gemfile allows you to use your prefer set of gems for your own
|
115
|
+
development workflow, like gems dedicated to debugging. Such gems are not part
|
116
|
+
of `cucumber-ruby` standard `Gemfile`.
|
117
|
+
|
118
|
+
`Gemfile.local`, `Gemfile.local.lock` and `.bundle` have been added to
|
119
|
+
`.gitignore` so local changes cannot be accidentaly commited and pushed to the
|
120
|
+
repository.
|
121
|
+
|
122
|
+
A `Gemfile.local` may look like this:
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
# Gemfile.local
|
126
|
+
|
127
|
+
# Include the regular Gemfile
|
128
|
+
eval File.read('Gemfile')
|
129
|
+
|
130
|
+
# Include your favorites development gems
|
131
|
+
group :development do
|
132
|
+
gem 'byebug'
|
133
|
+
gem 'pry'
|
134
|
+
gem 'pry-byebug'
|
135
|
+
|
136
|
+
gem 'debase', require: false
|
137
|
+
gem 'ruby-debug-ide', require: false
|
138
|
+
end
|
139
|
+
```
|
140
|
+
|
141
|
+
Then you can execute bundler with the `--gemfile` flag:
|
142
|
+
`bundle install --gemfile Gemfile.local`, or with an environment variable:
|
143
|
+
`BUNDLE_GEMFILE=Gemfile.local bundle [COMMAND]`.
|
144
|
+
|
145
|
+
To use your local Gemfile per default, you can also execute
|
146
|
+
`bundle config set --local gemfile Gemfile.local`.
|
147
|
+
|
148
|
+
### First timer? Welcome!
|
149
|
+
|
150
|
+
Looking for something simple to begin with? Look at issues with the label
|
151
|
+
'[good first issue](https://github.com/cucumber/cucumber-ruby-core/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)'.
|
152
|
+
|
153
|
+
### Having trouble getting started with the code? We're here to help!
|
154
|
+
|
155
|
+
If you have trouble setting-up your development environment, or getting started
|
156
|
+
with the code, you can join us on [Slack][community-slack]. You will find there
|
157
|
+
a lot of contributors.
|
158
|
+
|
159
|
+
Full-time maintainers are also available. We would be please to have 1:1 pairing
|
160
|
+
sessions to help you getting started. Look for
|
161
|
+
[Matt Wynne](https://cucumberbdd.slack.com/team/U590XDLF3) or
|
162
|
+
[Aurélien Reeves](https://cucumberbdd.slack.com/team/U011BB95MC7) on
|
163
|
+
[Slack][community-slack].
|
164
|
+
|
165
|
+
### Additional documentation and notice
|
166
|
+
|
167
|
+
You can find additional documentation in the [docs](./docs) directory such as
|
168
|
+
(non-exhaustive list):
|
169
|
+
|
170
|
+
- [How to release cucumber-ruby-core](./docs/RELEASE_PROCESS.md) (for maintainers)
|
171
|
+
- [Overview of cucumber-ruby-core](./docs/ARCHITECTURE.md)
|
172
|
+
|
173
|
+
<!-- Links -->
|
174
|
+
|
175
|
+
[community-slack]: https://cucumberbdd.slack.com/
|
176
|
+
[cucumber/common]: https://github.com/cucumber/common
|
177
|
+
[cucumber-ruby]: https://github.com/cucumber/cucumber-ruby
|
178
|
+
[cucumber-ruby-core]: https://github.com/cucumber/cucumber-ruby-core
|
179
|
+
[cucumber-ruby-core-issues]: https://github.com/cucumber/cucumber-ruby-core/search?q=is%3Aissue
|
180
|
+
[cucumber/common-issues]: https://github.com/cucumber/common/search?q=is%3Aissue
|
181
|
+
[cucumber-issues]: https://github.com/search?q=is%3Aissue+user%3Acucumber
|
182
|
+
[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
|
183
|
+
[how-to-fork]: https://docs.github.com/github/collaborating-with-pull-requests/working-with-forks/about-forks
|
184
|
+
[sign your commits]: https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification/signing-commits
|
185
|
+
[minimal-reproducible-example]: https://stackoverflow.com/help/minimal-reproducible-example
|
186
|
+
[Bundler]: https://bundler.io/
|
data/README.md
CHANGED
@@ -1,123 +1,128 @@
|
|
1
|
-
|
1
|
+
<p align="center">
|
2
|
+
<img src="./.github/img/cucumber-open-logo.png" alt="Cucumber Open - Supported by Smartbear" width="428" />
|
3
|
+
</p>
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
[](https://opencollective.com/cucumber)
|
8
|
+
[](https://opencollective.com/cucumber)
|
6
9
|
[](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby-core)
|
7
10
|
[](https://oselvar.com/github/cucumber/oselvar-github-metrics/main/cucumber/cucumber-ruby-core)
|
11
|
+
[](https://github.com/cucumber/cucumber-ruby-core/actions/workflows/cucumber-ruby-core.yml)
|
12
|
+
[](https://codeclimate.com/github/cucumber/cucumber-ruby-core)
|
13
|
+
[](https://coveralls.io/r/cucumber/cucumber-ruby-core?branch=main)
|
8
14
|
|
9
|
-
Cucumber
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
## An overview
|
14
|
-
|
15
|
-
The entry-point is a single method on the module [`Cucumber::Core`](Cucumber/Core.html) called [`#execute`](Cucumber/Core.html#execute-instance_method). Here's what it does:
|
16
|
-
|
17
|
-
1. Parses the plain-text Gherkin documents into an **AST**
|
18
|
-
2. Compiles the AST down to **test cases**
|
19
|
-
3. Passes the test cases through any **filters**
|
20
|
-
4. Executes the test cases, emitting **events** as it goes
|
21
|
-
|
22
|
-
We've introduced a number of concepts here, so let's go through them in detail.
|
15
|
+
Cucumber is a tool for running automated tests written in plain language. Because they're
|
16
|
+
written in plain language, they can be read by anyone on your team. Because they can be
|
17
|
+
read by anyone, you can use them to help improve communication, collaboration and trust on
|
18
|
+
your team.
|
23
19
|
|
24
|
-
|
20
|
+
<p align="center">
|
21
|
+
<img src="./.github/img/gherkin-example.png" alt="Cucumber Gherkin Example" width="728" />
|
22
|
+
</p>
|
25
23
|
|
26
|
-
|
24
|
+
Cucumber Core is the [inner hexagon](https://en.wikipedia.org/wiki/Hexagonal_architecture_(software))
|
25
|
+
for the [Ruby flavour of Cucumber](https://github.com/cucumber/cucumber-ruby).
|
27
26
|
|
28
|
-
|
27
|
+
It contains the core domain logic to execute Cucumber features. It has no user interface,
|
28
|
+
just a Ruby API. If you're interested in how Cucumber works, or in building other
|
29
|
+
tools that work with Gherkin documents, you've come to the right place.
|
29
30
|
|
30
|
-
|
31
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for info on contributing to Cucumber (issues,
|
32
|
+
PRs, etc.).
|
31
33
|
|
32
|
-
|
34
|
+
Everyone interacting in this codebase and issue tracker is expected to follow the
|
35
|
+
Cucumber [code of conduct](https://cucumber.io/conduct).
|
33
36
|
|
34
|
-
|
37
|
+
## Installation
|
35
38
|
|
36
|
-
|
39
|
+
`cucumber-core` is a Ruby gem. Install it as you would install any gem: add
|
40
|
+
`cucumber-core` to your Gemfile:
|
37
41
|
|
38
|
-
|
42
|
+
gem 'cucumber-core'
|
39
43
|
|
40
|
-
|
44
|
+
then install it:
|
41
45
|
|
42
|
-
|
46
|
+
$ bundle
|
43
47
|
|
44
|
-
|
48
|
+
or install the gem directly:
|
45
49
|
|
46
|
-
|
50
|
+
$ gem install cucumber-core
|
47
51
|
|
48
|
-
|
49
|
-
- [`TestStepStarting`](Cucumber/Core/Events/TestStepStarting.html)
|
50
|
-
- [`TestStepFinished`](Cucumber/Core/Events/TestStepFinished.html)
|
51
|
-
- [`TestCaseFinished`](Cucumber/Core/Events/TestCaseFinished.html)
|
52
|
+
### Supported platforms
|
52
53
|
|
53
|
-
|
54
|
+
- Ruby 3.0
|
55
|
+
- Ruby 2.7
|
56
|
+
- Ruby 2.6
|
57
|
+
- Ruby 2.5
|
58
|
+
- Ruby 2.4
|
59
|
+
- Ruby 2.3
|
60
|
+
- JRuby 9.2 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/main/docs/jruby-limitations.md))
|
54
61
|
|
55
|
-
##
|
62
|
+
## Usage
|
56
63
|
|
57
|
-
|
64
|
+
The following example aims to illustrate how to use `cucumber-core` gem and to
|
65
|
+
make sure it is working well within your environment. For more details
|
66
|
+
explanation on what it actually does and how to work with it, see
|
67
|
+
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
58
68
|
|
59
69
|
```ruby
|
70
|
+
# cucumber_core_example.rb
|
71
|
+
|
60
72
|
require 'cucumber/core'
|
61
73
|
require 'cucumber/core/filter'
|
62
74
|
|
63
|
-
# This is the most complex part of the example. The filter takes test cases as input,
|
64
|
-
# activates each step with an action block, then passes a new test case with those activated
|
65
|
-
# steps in it on to the next filter in the chain.
|
66
75
|
class ActivateSteps < Cucumber::Core::Filter.new
|
67
76
|
def test_case(test_case)
|
68
77
|
test_steps = test_case.test_steps.map do |step|
|
69
|
-
|
78
|
+
step.with_action { print "processing: " }
|
70
79
|
end
|
71
80
|
|
72
81
|
test_case.with_steps(test_steps).describe_to(receiver)
|
73
82
|
end
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
def activate(step)
|
78
|
-
case step.text
|
79
|
-
when /fail/
|
80
|
-
step.with_action { raise Failure }
|
81
|
-
when /pass/
|
82
|
-
step.with_action {}
|
83
|
-
else
|
84
|
-
step
|
85
|
-
end
|
86
|
-
end
|
87
83
|
end
|
88
84
|
|
89
|
-
# Create a Gherkin document to run
|
90
85
|
feature = Cucumber::Core::Gherkin::Document.new(__FILE__, <<-GHERKIN)
|
91
86
|
Feature:
|
92
87
|
Scenario:
|
93
|
-
Given
|
94
|
-
|
95
|
-
|
88
|
+
Given some requirements
|
89
|
+
When we do something
|
90
|
+
Then it should pass
|
96
91
|
GHERKIN
|
97
92
|
|
98
|
-
# Create a runner class that uses the Core's DSL
|
99
93
|
class MyRunner
|
100
94
|
include Cucumber::Core
|
101
95
|
end
|
102
96
|
|
103
|
-
# Now execute the feature, using the filter we built, and subscribing to
|
104
|
-
# an event so we can print the output.
|
105
97
|
MyRunner.new.execute([feature], [ActivateSteps.new]) do |events|
|
106
98
|
events.on(:test_step_finished) do |event|
|
107
99
|
test_step, result = event.test_step, event.result
|
108
|
-
|
100
|
+
print "#{test_step.text} #{result}\n"
|
109
101
|
end
|
110
102
|
end
|
111
103
|
```
|
112
104
|
|
113
|
-
If you run this
|
105
|
+
If you run this Ruby script:
|
114
106
|
|
107
|
+
```shell
|
108
|
+
ruby cucumber_core_example.rb
|
115
109
|
```
|
116
|
-
|
117
|
-
|
118
|
-
|
110
|
+
|
111
|
+
You should see the following output:
|
112
|
+
|
113
|
+
```
|
114
|
+
processing: some requirements ✓
|
115
|
+
processing: we do something ✓
|
116
|
+
processing: it should pass ✓
|
119
117
|
```
|
120
118
|
|
119
|
+
## Documentation and support
|
120
|
+
|
121
|
+
- Getting started with Cucumber, writing features, step definitions, and more: https://cucumber.io/docs
|
122
|
+
- Slack: [register for an account](https://cucumberbdd-slack-invite.herokuapp.com/) then head over to [#intro](https://cucumberbdd.slack.com/messages/C5WD8SA21/)
|
123
|
+
- `cucumber-core` overview: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
|
124
|
+
- How to work with local repositories for `cucumber-gherkin`, `cucumber-messages` or `cucumber-ruby`: [CONTRIBUTING.md#working-with-local-cucumber-dependencies](./CONTRIBUTING.md#working-with-local-cucumber-dependencies)
|
125
|
+
|
121
126
|
## Copyright
|
122
127
|
|
123
|
-
Copyright (c) Cucumber
|
128
|
+
Copyright (c) Cucumber Ltd. and Contributors. See LICENSE for details.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
|
-
|
3
|
+
require "cucumber/messages"
|
4
4
|
require "cucumber/messages/time_conversion"
|
5
5
|
|
6
6
|
module Cucumber
|
@@ -46,8 +46,8 @@ module Cucumber
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def to_message
|
49
|
-
Cucumber::Messages::
|
50
|
-
status: Cucumber::Messages::
|
49
|
+
Cucumber::Messages::TestStepResult.new(
|
50
|
+
status: Cucumber::Messages::TestStepResultStatus::UNKNOWN,
|
51
51
|
duration: UnknownDuration.new.to_message_duration
|
52
52
|
)
|
53
53
|
end
|
@@ -77,8 +77,8 @@ module Cucumber
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def to_message
|
80
|
-
Cucumber::Messages::
|
81
|
-
status: Cucumber::Messages::
|
80
|
+
Cucumber::Messages::TestStepResult.new(
|
81
|
+
status: Cucumber::Messages::TestStepResultStatus::PASSED,
|
82
82
|
duration: duration.to_message_duration
|
83
83
|
)
|
84
84
|
end
|
@@ -130,8 +130,8 @@ module Cucumber
|
|
130
130
|
message = ""
|
131
131
|
end
|
132
132
|
|
133
|
-
Cucumber::Messages::
|
134
|
-
status: Cucumber::Messages::
|
133
|
+
Cucumber::Messages::TestStepResult.new(
|
134
|
+
status: Cucumber::Messages::TestStepResultStatus::FAILED,
|
135
135
|
duration: duration.to_message_duration,
|
136
136
|
message: message
|
137
137
|
)
|
@@ -218,8 +218,8 @@ module Cucumber
|
|
218
218
|
end
|
219
219
|
|
220
220
|
def to_message
|
221
|
-
Cucumber::Messages::
|
222
|
-
status: Cucumber::Messages::
|
221
|
+
Cucumber::Messages::TestStepResult.new(
|
222
|
+
status: Cucumber::Messages::TestStepResultStatus::UNDEFINED,
|
223
223
|
duration: duration.to_message_duration
|
224
224
|
)
|
225
225
|
end
|
@@ -243,8 +243,8 @@ module Cucumber
|
|
243
243
|
end
|
244
244
|
|
245
245
|
def to_message
|
246
|
-
Cucumber::Messages::
|
247
|
-
status: Cucumber::Messages::
|
246
|
+
Cucumber::Messages::TestStepResult.new(
|
247
|
+
status: Cucumber::Messages::TestStepResultStatus::SKIPPED,
|
248
248
|
duration: duration.to_message_duration
|
249
249
|
)
|
250
250
|
end
|
@@ -268,8 +268,8 @@ module Cucumber
|
|
268
268
|
end
|
269
269
|
|
270
270
|
def to_message
|
271
|
-
Cucumber::Messages::
|
272
|
-
status: Cucumber::Messages::
|
271
|
+
Cucumber::Messages::TestStepResult.new(
|
272
|
+
status: Cucumber::Messages::TestStepResultStatus::PENDING,
|
273
273
|
duration: duration.to_message_duration
|
274
274
|
)
|
275
275
|
end
|
@@ -404,7 +404,14 @@ module Cucumber
|
|
404
404
|
end
|
405
405
|
|
406
406
|
def to_message_duration
|
407
|
-
seconds_to_duration(nanoseconds.to_f / NANOSECONDS_PER_SECOND)
|
407
|
+
duration_hash = seconds_to_duration(nanoseconds.to_f / NANOSECONDS_PER_SECOND)
|
408
|
+
duration_hash.transform_keys! do |key|
|
409
|
+
key.to_sym
|
410
|
+
rescue Error
|
411
|
+
return key
|
412
|
+
end
|
413
|
+
|
414
|
+
Cucumber::Messages::Duration.from_h(duration_hash)
|
408
415
|
end
|
409
416
|
end
|
410
417
|
|
@@ -420,7 +427,7 @@ module Cucumber
|
|
420
427
|
end
|
421
428
|
|
422
429
|
def to_message_duration
|
423
|
-
|
430
|
+
Cucumber::Messages::Duration.new(seconds: 0, nanos: 0)
|
424
431
|
end
|
425
432
|
end
|
426
433
|
end
|
@@ -19,7 +19,7 @@ module Cucumber
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def sec
|
22
|
-
nsec / 10**9.0
|
22
|
+
nsec / (10**9.0)
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
@@ -42,7 +42,7 @@ module Cucumber
|
|
42
42
|
else
|
43
43
|
def time_in_nanoseconds
|
44
44
|
t = Time.now
|
45
|
-
t.to_i * 10**9 + t.nsec
|
45
|
+
(t.to_i * (10**9)) + t.nsec
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
# -*- coding: utf-8 -*-
|
3
2
|
require 'cucumber/core'
|
4
3
|
require 'cucumber/core/gherkin/writer'
|
5
4
|
require 'cucumber/core/platform'
|
@@ -25,7 +24,7 @@ module Cucumber
|
|
25
24
|
it "describes itself to a visitor" do
|
26
25
|
visitor = double
|
27
26
|
args = double
|
28
|
-
expect(
|
27
|
+
expect(visitor).to receive(:test_case).with(test_case, args)
|
29
28
|
test_case.describe_to(visitor, args)
|
30
29
|
end
|
31
30
|
|
@@ -33,68 +32,68 @@ module Cucumber
|
|
33
32
|
visitor = double
|
34
33
|
args = double
|
35
34
|
test_steps.each do |test_step|
|
36
|
-
expect(
|
35
|
+
expect(test_step).to receive(:describe_to).with(visitor, args)
|
37
36
|
end
|
38
|
-
allow(
|
37
|
+
allow(visitor).to receive(:test_case).and_yield(visitor)
|
39
38
|
test_case.describe_to(visitor, args)
|
40
39
|
end
|
41
40
|
|
42
41
|
it "describes around hooks in order" do
|
43
42
|
visitor = double
|
44
|
-
allow(
|
45
|
-
first_hook
|
46
|
-
|
47
|
-
expect(
|
43
|
+
allow(visitor).to receive(:test_case).and_yield(visitor)
|
44
|
+
first_hook = double
|
45
|
+
second_hook = double
|
46
|
+
expect(first_hook).to receive(:describe_to).ordered.and_yield
|
47
|
+
expect(second_hook).to receive(:describe_to).ordered.and_yield
|
48
48
|
around_hooks = [first_hook, second_hook]
|
49
49
|
Test::Case.new(id, name, [], location, tags, language, around_hooks).describe_to(visitor, double)
|
50
50
|
end
|
51
|
-
|
52
51
|
end
|
53
52
|
|
54
53
|
describe "#name" do
|
55
54
|
it "the name is passed when creating the test case" do
|
56
|
-
expect(
|
55
|
+
expect(test_case.name).to eq(name)
|
57
56
|
end
|
58
57
|
end
|
59
58
|
|
60
59
|
describe "#location" do
|
61
60
|
it "the location is passed when creating the test case" do
|
62
|
-
expect(
|
61
|
+
expect(test_case.location).to eq(location)
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
66
65
|
describe "#tags" do
|
67
66
|
it "the tags are passed when creating the test case" do
|
68
|
-
expect(
|
67
|
+
expect(test_case.tags).to eq(tags)
|
69
68
|
end
|
70
69
|
end
|
71
70
|
|
72
71
|
describe "matching tags" do
|
73
72
|
let(:tags) { ['@a', '@b', '@c'].map { |value| Tag.new(location, value) } }
|
74
73
|
it "matches tags using tag expressions" do
|
75
|
-
expect(
|
76
|
-
expect(
|
77
|
-
expect(
|
78
|
-
expect(
|
74
|
+
expect(test_case.match_tags?(['@a and @b'])).to be_truthy
|
75
|
+
expect(test_case.match_tags?(['@a or @d'])).to be_truthy
|
76
|
+
expect(test_case.match_tags?(['not @d'])).to be_truthy
|
77
|
+
expect(test_case.match_tags?(['@a and @d'])).to be_falsy
|
79
78
|
end
|
80
79
|
|
81
80
|
it "matches handles multiple expressions" do
|
82
|
-
expect(
|
83
|
-
expect(
|
81
|
+
expect(test_case.match_tags?(['@a and @b', 'not @d'])).to be_truthy
|
82
|
+
expect(test_case.match_tags?(['@a and @b', 'not @c'])).to be_falsy
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
87
86
|
describe "matching names" do
|
88
87
|
let(:name) { 'scenario' }
|
89
88
|
it "matches names against regexp" do
|
90
|
-
expect(
|
89
|
+
expect(test_case.match_name?(/scenario/)).to be_truthy
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
94
93
|
describe "#language" do
|
95
94
|
let(:language) { 'en-pirate' }
|
96
95
|
it "the language is passed when creating the test case" do
|
97
|
-
expect(
|
96
|
+
expect(test_case.language).to eq 'en-pirate'
|
98
97
|
end
|
99
98
|
end
|
100
99
|
|
@@ -120,7 +119,6 @@ module Cucumber
|
|
120
119
|
expect(test_case_instances[0]).not_to equal test_case_instances[1]
|
121
120
|
end
|
122
121
|
end
|
123
|
-
|
124
122
|
end
|
125
123
|
end
|
126
124
|
end
|
@@ -232,14 +232,14 @@ module Cucumber::Core
|
|
232
232
|
let(:locations) do
|
233
233
|
(1..num_locations).map do |i|
|
234
234
|
(1..num_scenarios_per_feature).map do |j|
|
235
|
-
line = 3 + (j - 1) * 3
|
235
|
+
line = 3 + ((j - 1) * 3)
|
236
236
|
Test::Location.new("features/test_#{i}.feature", line)
|
237
237
|
end
|
238
238
|
end.flatten
|
239
239
|
end
|
240
240
|
|
241
241
|
max_duration_ms = 10000
|
242
|
-
max_duration_ms
|
242
|
+
max_duration_ms *= 2.5 if defined?(JRUBY_VERSION)
|
243
243
|
it "filters #{num_features * num_scenarios_per_feature} test cases within #{max_duration_ms}ms" do
|
244
244
|
filter = Test::LocationsFilter.new(locations)
|
245
245
|
Timeout.timeout(max_duration_ms / 1000.0) do
|
@@ -25,7 +25,7 @@ module Cucumber::Core::Test
|
|
25
25
|
|
26
26
|
it "converts to a Cucumber::Message::TestResult" do
|
27
27
|
message = result.to_message
|
28
|
-
expect(message.status).to eq(Cucumber::Messages::
|
28
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::PASSED)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "has a duration" do
|
@@ -75,7 +75,7 @@ module Cucumber::Core::Test
|
|
75
75
|
|
76
76
|
it "converts to a Cucumber::Message::TestResult" do
|
77
77
|
message = result.to_message
|
78
|
-
expect(message.status).to eq(Cucumber::Messages::
|
78
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::FAILED)
|
79
79
|
end
|
80
80
|
|
81
81
|
it "requires both constructor arguments" do
|
@@ -144,7 +144,7 @@ module Cucumber::Core::Test
|
|
144
144
|
|
145
145
|
it "converts to a Cucumber::Message::TestResult" do
|
146
146
|
message = result.to_message
|
147
|
-
expect(message.status).to eq(Cucumber::Messages::
|
147
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::UNKNOWN)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
@@ -207,7 +207,7 @@ module Cucumber::Core::Test
|
|
207
207
|
|
208
208
|
it "converts to a Cucumber::Message::TestResult" do
|
209
209
|
message = result.to_message
|
210
|
-
expect(message.status).to eq(Cucumber::Messages::
|
210
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::UNDEFINED)
|
211
211
|
end
|
212
212
|
|
213
213
|
specify { expect( result.to_sym ).to eq :undefined }
|
@@ -236,7 +236,7 @@ module Cucumber::Core::Test
|
|
236
236
|
|
237
237
|
it "converts to a Cucumber::Message::TestResult" do
|
238
238
|
message = result.to_message
|
239
|
-
expect(message.status).to eq(Cucumber::Messages::
|
239
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::SKIPPED)
|
240
240
|
end
|
241
241
|
|
242
242
|
specify { expect( result.to_sym ).to eq :skipped }
|
@@ -263,7 +263,7 @@ module Cucumber::Core::Test
|
|
263
263
|
|
264
264
|
it "converts to a Cucumber::Message::TestResult" do
|
265
265
|
message = result.to_message
|
266
|
-
expect(message.status).to eq(Cucumber::Messages::
|
266
|
+
expect(message.status).to eq(Cucumber::Messages::TestStepResultStatus::PENDING)
|
267
267
|
end
|
268
268
|
|
269
269
|
specify { expect( result.to_sym ).to eq :pending }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: cucumber-gherkin
|
@@ -20,60 +20,60 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - "~>"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '22.0'
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 22.0.0
|
27
27
|
type: :runtime
|
28
28
|
prerelease: false
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '22.0'
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
36
|
+
version: 22.0.0
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: cucumber-messages
|
39
39
|
requirement: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '17.1'
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 17.1.1
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '17.1'
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
56
|
+
version: 17.1.1
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: cucumber-tag-expressions
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
63
|
+
version: '4.1'
|
64
64
|
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
66
|
+
version: 4.1.0
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
73
|
+
version: '4.1'
|
74
74
|
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 4.1.0
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: coveralls
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,7 +103,7 @@ dependencies:
|
|
103
103
|
version: '13.0'
|
104
104
|
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 13.0.
|
106
|
+
version: 13.0.6
|
107
107
|
type: :development
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -113,7 +113,7 @@ dependencies:
|
|
113
113
|
version: '13.0'
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 13.0.
|
116
|
+
version: 13.0.6
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: rspec
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,20 +140,20 @@ dependencies:
|
|
140
140
|
requirements:
|
141
141
|
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: '1.
|
143
|
+
version: '1.24'
|
144
144
|
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 1.
|
146
|
+
version: 1.24.1
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
151
|
- - "~>"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: '1.
|
153
|
+
version: '1.24'
|
154
154
|
- - ">="
|
155
155
|
- !ruby/object:Gem::Version
|
156
|
-
version: 1.
|
156
|
+
version: 1.24.1
|
157
157
|
- !ruby/object:Gem::Dependency
|
158
158
|
name: rubocop-packaging
|
159
159
|
requirement: !ruby/object:Gem::Requirement
|
@@ -284,27 +284,27 @@ requirements: []
|
|
284
284
|
rubygems_version: 3.1.2
|
285
285
|
signing_key:
|
286
286
|
specification_version: 4
|
287
|
-
summary: cucumber-core-
|
287
|
+
summary: cucumber-core-10.1.1
|
288
288
|
test_files:
|
289
|
-
- spec/cucumber/core_spec.rb
|
290
|
-
- spec/cucumber/core/report/summary_spec.rb
|
291
289
|
- spec/cucumber/core/compiler_spec.rb
|
292
|
-
- spec/cucumber/core/gherkin/parser_spec.rb
|
293
|
-
- spec/cucumber/core/gherkin/writer_spec.rb
|
294
|
-
- spec/cucumber/core/event_bus_spec.rb
|
295
290
|
- spec/cucumber/core/filter_spec.rb
|
291
|
+
- spec/cucumber/core/test/data_table_spec.rb
|
296
292
|
- spec/cucumber/core/test/timer_spec.rb
|
297
|
-
- spec/cucumber/core/test/case_spec.rb
|
298
|
-
- spec/cucumber/core/test/result_spec.rb
|
299
|
-
- spec/cucumber/core/test/action_spec.rb
|
300
293
|
- spec/cucumber/core/test/filters/locations_filter_spec.rb
|
301
|
-
- spec/cucumber/core/test/runner_spec.rb
|
302
294
|
- spec/cucumber/core/test/doc_string_spec.rb
|
303
|
-
- spec/cucumber/core/test/location_spec.rb
|
304
|
-
- spec/cucumber/core/test/duration_matcher.rb
|
305
|
-
- spec/cucumber/core/test/data_table_spec.rb
|
306
295
|
- spec/cucumber/core/test/step_spec.rb
|
296
|
+
- spec/cucumber/core/test/runner_spec.rb
|
297
|
+
- spec/cucumber/core/test/result_spec.rb
|
298
|
+
- spec/cucumber/core/test/location_spec.rb
|
307
299
|
- spec/cucumber/core/test/empty_multiline_argument_spec.rb
|
300
|
+
- spec/cucumber/core/test/duration_matcher.rb
|
301
|
+
- spec/cucumber/core/test/case_spec.rb
|
302
|
+
- spec/cucumber/core/test/action_spec.rb
|
303
|
+
- spec/cucumber/core/report/summary_spec.rb
|
308
304
|
- spec/cucumber/core/event_spec.rb
|
305
|
+
- spec/cucumber/core/gherkin/writer_spec.rb
|
306
|
+
- spec/cucumber/core/gherkin/parser_spec.rb
|
307
|
+
- spec/cucumber/core/event_bus_spec.rb
|
308
|
+
- spec/cucumber/core_spec.rb
|
309
309
|
- spec/report_api_spy.rb
|
310
310
|
- spec/coverage.rb
|