casecumber 1.0.2.1 → 1.2.1.cb2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/.travis.yml +13 -6
- data/Gemfile +2 -0
- data/History.md +139 -0
- data/LICENSE +1 -1
- data/README.md +19 -4
- data/cucumber.gemspec +16 -29
- data/cucumber.yml +3 -3
- data/examples/i18n/README.textile +1 -16
- data/features/.cucumber/stepdefs.json +612 -0
- data/features/backtraces.feature +36 -0
- data/features/doc_strings.feature +73 -0
- data/features/drb_server_integration.feature +63 -0
- data/features/formatter_step_file_colon_line.feature +46 -0
- data/features/json_formatter.feature +137 -137
- data/features/nested_steps.feature +60 -0
- data/features/rerun_formatter.feature +35 -0
- data/features/run_specific_scenarios.feature +47 -0
- data/features/step_definitions/cucumber-features/cucumber_ruby_mappings.rb +32 -3
- data/features/step_definitions/cucumber_steps.rb +15 -0
- data/features/step_definitions/drb_steps.rb +3 -0
- data/features/support/env.rb +4 -0
- data/features/support/feature_factory.rb +50 -0
- data/gem_tasks/cucumber.rake +15 -8
- data/gem_tasks/yard.rake +18 -0
- data/legacy_features/call_steps_from_stepdefs.feature +1 -1
- data/legacy_features/cucumber_cli.feature +0 -7
- data/legacy_features/default_snippets.feature +3 -2
- data/legacy_features/junit_formatter.feature +60 -10
- data/legacy_features/language_help.feature +17 -15
- data/legacy_features/snippets_when_using_star_keyword.feature +3 -2
- data/legacy_features/step_definitions/cucumber_steps.rb +1 -1
- data/legacy_features/support/env.rb +1 -1
- data/legacy_features/wire_protocol.feature +1 -1
- data/lib/cucumber/ast/background.rb +11 -0
- data/lib/cucumber/ast/doc_string.rb +10 -29
- data/lib/cucumber/ast/feature.rb +6 -2
- data/lib/cucumber/ast/feature_element.rb +7 -3
- data/lib/cucumber/ast/multiline_argument.rb +30 -0
- data/lib/cucumber/ast/outline_table.rb +20 -12
- data/lib/cucumber/ast/step.rb +1 -1
- data/lib/cucumber/ast/step_invocation.rb +2 -15
- data/lib/cucumber/ast/table.rb +67 -38
- data/lib/cucumber/ast/tags.rb +7 -7
- data/lib/cucumber/ast/tree_walker.rb +5 -5
- data/lib/cucumber/cli/configuration.rb +4 -0
- data/lib/cucumber/cli/main.rb +1 -0
- data/lib/cucumber/cli/options.rb +29 -10
- data/lib/cucumber/constantize.rb +1 -1
- data/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +24 -10
- data/lib/cucumber/formatter/ansicolor.rb +8 -13
- data/lib/cucumber/formatter/console.rb +3 -2
- data/lib/cucumber/formatter/cucumber.css +7 -1
- data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +6 -2
- data/lib/cucumber/formatter/html.rb +14 -8
- data/lib/cucumber/formatter/interceptor.rb +62 -0
- data/lib/cucumber/formatter/json.rb +0 -12
- data/lib/cucumber/formatter/junit.rb +31 -15
- data/lib/cucumber/formatter/pretty.rb +3 -3
- data/lib/cucumber/formatter/progress.rb +1 -1
- data/lib/cucumber/formatter/rerun.rb +31 -8
- data/lib/cucumber/formatter/usage.rb +1 -1
- data/lib/cucumber/js_support/js_language.rb +1 -1
- data/lib/cucumber/js_support/js_snippets.rb +1 -1
- data/lib/cucumber/language_support/language_methods.rb +0 -4
- data/lib/cucumber/parser/gherkin_builder.rb +13 -14
- data/lib/cucumber/platform.rb +1 -1
- data/lib/cucumber/py_support/py_language.rb +3 -7
- data/lib/cucumber/rb_support/rb_dsl.rb +15 -8
- data/lib/cucumber/rb_support/rb_language.rb +3 -17
- data/lib/cucumber/rb_support/rb_step_definition.rb +17 -5
- data/lib/cucumber/rb_support/rb_transform.rb +5 -2
- data/lib/cucumber/rb_support/rb_world.rb +9 -5
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +3 -3
- data/lib/cucumber/runtime/results.rb +2 -2
- data/lib/cucumber/runtime/support_code.rb +14 -19
- data/lib/cucumber/runtime.rb +40 -2
- data/lib/cucumber/step_match.rb +3 -4
- data/lib/cucumber/term/ansicolor.rb +118 -0
- data/lib/cucumber/wire_support/wire_protocol/requests.rb +7 -5
- data/lib/cucumber/wire_support/wire_protocol.rb +0 -1
- data/lib/cucumber.rb +2 -1
- data/spec/cucumber/ast/doc_string_spec.rb +2 -2
- data/spec/cucumber/ast/feature_factory.rb +4 -3
- data/spec/cucumber/ast/scenario_outline_spec.rb +1 -2
- data/spec/cucumber/ast/step_spec.rb +1 -1
- data/spec/cucumber/ast/table_spec.rb +61 -27
- data/spec/cucumber/cli/configuration_spec.rb +12 -6
- data/spec/cucumber/cli/main_spec.rb +2 -2
- data/spec/cucumber/cli/options_spec.rb +9 -3
- data/spec/cucumber/constantize_spec.rb +16 -0
- data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
- data/spec/cucumber/formatter/html_spec.rb +4 -3
- data/spec/cucumber/formatter/interceptor_spec.rb +111 -0
- data/spec/cucumber/formatter/junit_spec.rb +36 -20
- data/spec/cucumber/formatter/progress_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_language_spec.rb +5 -5
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +20 -4
- data/spec/cucumber/rb_support/rb_transform_spec.rb +6 -2
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +7 -3
- data/spec/cucumber/runtime/results_spec.rb +81 -0
- data/spec/cucumber/step_match_spec.rb +8 -4
- data/spec/spec_helper.rb +15 -1
- metadata +68 -128
- data/.gitignore +0 -26
- data/.gitmodules +0 -3
- data/.yardopts +0 -0
- data/Gemfile.lock +0 -115
- data/examples/i18n/de/.gitignore +0 -1
- data/examples/i18n/en/.gitignore +0 -1
- data/examples/i18n/eo/.gitignore +0 -1
- data/examples/i18n/fi/.gitignore +0 -1
- data/examples/i18n/hu/.gitignore +0 -1
- data/examples/i18n/id/.gitignore +0 -1
- data/examples/i18n/ja/.gitignore +0 -1
- data/examples/i18n/ko/.gitignore +0 -1
- data/examples/i18n/lt/.gitignore +0 -1
- data/examples/i18n/pl/.gitignore +0 -1
- data/examples/i18n/sk/.gitignore +0 -1
- data/examples/i18n/tr/.gitignore +0 -1
- data/examples/i18n/zh-TW/.gitignore +0 -1
- data/examples/python/lib/.gitignore +0 -1
- data/examples/ruby2python/lib/.gitignore +0 -1
- data/examples/watir/.gitignore +0 -2
- data/fixtures/self_test/.gitignore +0 -1
- data/lib/cucumber/formatter/pdf.rb +0 -244
- data/lib/cucumber/step_argument.rb +0 -9
@@ -0,0 +1,73 @@
|
|
1
|
+
Feature: Doc strings
|
2
|
+
|
3
|
+
If you need to specify information in a scenario that won't fit on a single line,
|
4
|
+
you can use a DocString.
|
5
|
+
|
6
|
+
A DocString follows a step, and starts and ends with three double quotes, like this:
|
7
|
+
|
8
|
+
```gherkin
|
9
|
+
When I ask to reset my password
|
10
|
+
Then I should receive an email with:
|
11
|
+
"""
|
12
|
+
Dear bozo,
|
13
|
+
|
14
|
+
Please click this link to reset your password
|
15
|
+
"""
|
16
|
+
```
|
17
|
+
|
18
|
+
It's possible to annotate the DocString with the type of content it contains. This is used by
|
19
|
+
formatting tools like http://relishapp.com which will render the contents of the DocString
|
20
|
+
appropriately. You specify the content type after the triple quote, like this:
|
21
|
+
|
22
|
+
```gherkin
|
23
|
+
Given there is some Ruby code:
|
24
|
+
"""ruby
|
25
|
+
puts "hello world"
|
26
|
+
"""
|
27
|
+
|
28
|
+
You can read the content type from the argument passed into your step definition, as shown
|
29
|
+
in the example below.
|
30
|
+
|
31
|
+
Scenario: Plain text Docstring
|
32
|
+
Given a scenario with a step that looks like this:
|
33
|
+
"""gherkin
|
34
|
+
Given I have a lot to say:
|
35
|
+
\"\"\"
|
36
|
+
One
|
37
|
+
Two
|
38
|
+
Three
|
39
|
+
\"\"\"
|
40
|
+
"""
|
41
|
+
And a step definition that looks like this:
|
42
|
+
"""ruby
|
43
|
+
Given /say/ do |text|
|
44
|
+
puts text
|
45
|
+
end
|
46
|
+
"""
|
47
|
+
When I run the feature with the progress formatter
|
48
|
+
Then the output should contain:
|
49
|
+
"""
|
50
|
+
One
|
51
|
+
Two
|
52
|
+
Three
|
53
|
+
"""
|
54
|
+
|
55
|
+
Scenario: DocString with interesting content type
|
56
|
+
Given a scenario with a step that looks like this:
|
57
|
+
"""gherkin
|
58
|
+
Given I have some code for you:
|
59
|
+
\"\"\"ruby
|
60
|
+
# hello
|
61
|
+
\"\"\"
|
62
|
+
"""
|
63
|
+
And a step definition that looks like this:
|
64
|
+
"""ruby
|
65
|
+
Given /code/ do |text|
|
66
|
+
puts text.content_type
|
67
|
+
end
|
68
|
+
"""
|
69
|
+
When I run the feature with the progress formatter
|
70
|
+
Then the output should contain:
|
71
|
+
"""
|
72
|
+
ruby
|
73
|
+
"""
|
@@ -0,0 +1,63 @@
|
|
1
|
+
@drb
|
2
|
+
Feature: DRb Server Integration
|
3
|
+
To prevent waiting for Rails and other large Ruby applications to load their environments
|
4
|
+
for each feature run Cucumber ships with a DRb client that can speak to a server which
|
5
|
+
loads up the environment only once.
|
6
|
+
|
7
|
+
This regression test highlights bug related to DRb server arguments processing, for more
|
8
|
+
details see https://github.com/cucumber/cucumber/issues/117
|
9
|
+
|
10
|
+
Background: App with Spork support
|
11
|
+
Spork is a gem that has a DRb server and the scenarios below illustrate how to use it.
|
12
|
+
However, any DRb server that adheres to the protocol that the client expects would work.
|
13
|
+
|
14
|
+
Given a directory without standard Cucumber project directory structure
|
15
|
+
And a file named "features/support/env.rb" with:
|
16
|
+
"""
|
17
|
+
require 'rubygems'
|
18
|
+
require 'spork'
|
19
|
+
|
20
|
+
Spork.prefork do
|
21
|
+
puts "I'm loading all the heavy stuff..."
|
22
|
+
end
|
23
|
+
|
24
|
+
Spork.each_run do
|
25
|
+
puts "I'm loading the stuff just for this run..."
|
26
|
+
end
|
27
|
+
"""
|
28
|
+
And a file named "config/cucumber.yml" with:
|
29
|
+
"""
|
30
|
+
<%
|
31
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
|
32
|
+
%>
|
33
|
+
default: --drb <%= std_opts %> features
|
34
|
+
"""
|
35
|
+
And a file named "features/sample.feature" with:
|
36
|
+
"""
|
37
|
+
# language: en
|
38
|
+
Feature: Sample
|
39
|
+
Scenario: this is a test
|
40
|
+
Given I am just testing stuff
|
41
|
+
"""
|
42
|
+
And a file named "features/step_definitions/all_your_steps_are_belong_to_us.rb" with:
|
43
|
+
"""
|
44
|
+
Given /^I am just testing stuff$/ do
|
45
|
+
# no-op
|
46
|
+
end
|
47
|
+
"""
|
48
|
+
|
49
|
+
Scenario: Single feature passing with '-r features' option
|
50
|
+
Given I am running spork in the background
|
51
|
+
When I run cucumber "features/sample.feature -r features --tags ~@wip"
|
52
|
+
And it should pass with:
|
53
|
+
"""
|
54
|
+
1 step (1 passed)
|
55
|
+
"""
|
56
|
+
|
57
|
+
Scenario: Single feature passing without '-r features' option
|
58
|
+
Given I am running spork in the background
|
59
|
+
When I run cucumber "features/sample.feature --tags ~@wip"
|
60
|
+
And it should pass with:
|
61
|
+
"""
|
62
|
+
1 step (1 passed)
|
63
|
+
"""
|
@@ -0,0 +1,46 @@
|
|
1
|
+
Feature: Formatter API: Step file path and line number (Issue #179)
|
2
|
+
To all reporter to understand location of current executing step let's fetch this information
|
3
|
+
from step/step_invocation and pass to reporters
|
4
|
+
|
5
|
+
Scenario: my own formatter
|
6
|
+
Given a file named "features/f.feature" with:
|
7
|
+
"""
|
8
|
+
Feature: I'll use my own
|
9
|
+
because I'm worth it
|
10
|
+
Scenario: just print step current line and feature file name
|
11
|
+
Given step at line 4
|
12
|
+
Given step at line 5
|
13
|
+
"""
|
14
|
+
And a file named "features/step_definitions/steps.rb" with:
|
15
|
+
"""
|
16
|
+
Given /^step at line (.*)$/ do |line|
|
17
|
+
end
|
18
|
+
"""
|
19
|
+
And a file named "features/support/jb/formatter.rb" with:
|
20
|
+
"""
|
21
|
+
module Jb
|
22
|
+
class Formatter
|
23
|
+
def initialize(step_mother, io, options)
|
24
|
+
@step_mother = step_mother
|
25
|
+
@io = io
|
26
|
+
end
|
27
|
+
|
28
|
+
def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
|
29
|
+
@io.puts "step result event: #{file_colon_line}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def step_name(keyword, step_match, status, source_indent, background, file_colon_line)
|
33
|
+
@io.puts "step name event: #{file_colon_line}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
"""
|
38
|
+
When I run cucumber "features/f.feature --format Jb::Formatter"
|
39
|
+
Then it should pass with exactly:
|
40
|
+
"""
|
41
|
+
step result event: features/f.feature:4
|
42
|
+
step name event: features/f.feature:4
|
43
|
+
step result event: features/f.feature:5
|
44
|
+
step name event: features/f.feature:5
|
45
|
+
|
46
|
+
"""
|
@@ -60,92 +60,90 @@ Feature: JSON output formatter
|
|
60
60
|
|
61
61
|
"""
|
62
62
|
|
63
|
-
Scenario: one feature, one passing scenario, one failing scenario
|
64
|
-
When I run cucumber "--format json features/one_passing_one_failing.feature"
|
65
|
-
Then the output should match /^\{"features":\[/
|
66
|
-
|
67
63
|
Scenario: one feature, one passing scenario, one failing scenario
|
68
64
|
When I run cucumber "--format json features/one_passing_one_failing.feature"
|
69
65
|
Then it should fail with JSON:
|
70
66
|
"""
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
"
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
]
|
110
|
-
},
|
111
|
-
{
|
112
|
-
"keyword": "Scenario",
|
113
|
-
"name": "Failing",
|
114
|
-
"line": 9,
|
115
|
-
"description": "",
|
116
|
-
"tags": [
|
117
|
-
{
|
118
|
-
"name": "@c",
|
119
|
-
"line": 8
|
67
|
+
[
|
68
|
+
{
|
69
|
+
"uri": "features/one_passing_one_failing.feature",
|
70
|
+
"keyword": "Feature",
|
71
|
+
"id": "one-passing-scenario,-one-failing-scenario",
|
72
|
+
"name": "One passing scenario, one failing scenario",
|
73
|
+
"line": 2,
|
74
|
+
"description": "",
|
75
|
+
"tags": [
|
76
|
+
{
|
77
|
+
"name": "@a",
|
78
|
+
"line": 1
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"elements": [
|
82
|
+
{
|
83
|
+
"keyword": "Scenario",
|
84
|
+
"id": "one-passing-scenario,-one-failing-scenario;passing",
|
85
|
+
"name": "Passing",
|
86
|
+
"line": 5,
|
87
|
+
"description": "",
|
88
|
+
"tags": [
|
89
|
+
{
|
90
|
+
"name": "@b",
|
91
|
+
"line": 4
|
92
|
+
}
|
93
|
+
],
|
94
|
+
"type": "scenario",
|
95
|
+
"steps": [
|
96
|
+
{
|
97
|
+
"keyword": "Given ",
|
98
|
+
"name": "a passing step",
|
99
|
+
"line": 6,
|
100
|
+
"match": {
|
101
|
+
"location": "features/step_definitions/steps.rb:1"
|
102
|
+
},
|
103
|
+
"result": {
|
104
|
+
"status": "passed"
|
120
105
|
}
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
106
|
+
}
|
107
|
+
]
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"keyword": "Scenario",
|
111
|
+
"id": "one-passing-scenario,-one-failing-scenario;failing",
|
112
|
+
"name": "Failing",
|
113
|
+
"line": 9,
|
114
|
+
"description": "",
|
115
|
+
"tags": [
|
116
|
+
{
|
117
|
+
"name": "@c",
|
118
|
+
"line": 8
|
119
|
+
}
|
120
|
+
],
|
121
|
+
"type": "scenario",
|
122
|
+
"steps": [
|
123
|
+
{
|
124
|
+
"keyword": "Given ",
|
125
|
+
"name": "a failing step",
|
126
|
+
"line": 10,
|
127
|
+
"match": {
|
128
|
+
"location": "features/step_definitions/steps.rb:5"
|
129
|
+
},
|
130
|
+
"result": {
|
131
|
+
"status": "failed",
|
132
|
+
"error_message": " (RuntimeError)\n./features/step_definitions/steps.rb:6:in `/a failing step/'\nfeatures/one_passing_one_failing.feature:10:in `Given a failing step'"
|
135
133
|
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
134
|
+
}
|
135
|
+
]
|
136
|
+
}
|
137
|
+
]
|
138
|
+
}
|
139
|
+
]
|
142
140
|
|
143
141
|
"""
|
144
142
|
|
145
|
-
Scenario:
|
146
|
-
Given a file named "features/
|
143
|
+
Scenario: DocString
|
144
|
+
Given a file named "features/doc_string.feature" with:
|
147
145
|
"""
|
148
|
-
Feature: A
|
146
|
+
Feature: A DocString feature
|
149
147
|
|
150
148
|
Scenario:
|
151
149
|
Then I should fail with
|
@@ -153,68 +151,26 @@ Feature: JSON output formatter
|
|
153
151
|
a string
|
154
152
|
\"\"\"
|
155
153
|
"""
|
156
|
-
And a file named "features/step_definitions/
|
154
|
+
And a file named "features/step_definitions/doc_string_steps.rb" with:
|
157
155
|
"""
|
158
156
|
Then /I should fail with/ do |s|
|
159
157
|
raise s
|
160
158
|
end
|
161
159
|
"""
|
162
|
-
When I run cucumber "--format json features/
|
160
|
+
When I run cucumber "--format json features/doc_string.feature"
|
163
161
|
Then it should fail with JSON:
|
164
162
|
"""
|
165
|
-
|
166
|
-
"features": [
|
167
|
-
{
|
168
|
-
"keyword": "Feature",
|
169
|
-
"name": "A pystring feature",
|
170
|
-
"line": 1,
|
171
|
-
"description": "",
|
172
|
-
"elements": [
|
173
|
-
{
|
174
|
-
"keyword": "Scenario",
|
175
|
-
"name": "",
|
176
|
-
"line": 3,
|
177
|
-
"description": "",
|
178
|
-
"type": "scenario",
|
179
|
-
"steps": [
|
180
|
-
{
|
181
|
-
"keyword": "Then ",
|
182
|
-
"name": "I should fail with",
|
183
|
-
"line": 4,
|
184
|
-
"multiline_arg": {
|
185
|
-
"value": "a string",
|
186
|
-
"line": 5,
|
187
|
-
"type": "doc_string"
|
188
|
-
},
|
189
|
-
"match": {
|
190
|
-
"location": "features/step_definitions/pystring_steps.rb:1"
|
191
|
-
},
|
192
|
-
"result": {
|
193
|
-
"status": "failed",
|
194
|
-
"error_message": "a string (RuntimeError)\n./features/step_definitions/pystring_steps.rb:2:in `/I should fail with/'\nfeatures/pystring.feature:4:in `Then I should fail with'"
|
195
|
-
}
|
196
|
-
}
|
197
|
-
]
|
198
|
-
}
|
199
|
-
]
|
200
|
-
}
|
201
|
-
]
|
202
|
-
}
|
203
|
-
"""
|
204
|
-
|
205
|
-
Scenario: embedding screenshot
|
206
|
-
When I run cucumber "-b --format json features/embed.feature"
|
207
|
-
Then it should pass with JSON:
|
208
|
-
"""
|
209
|
-
{
|
210
|
-
"features": [
|
163
|
+
[
|
211
164
|
{
|
165
|
+
"id": "a-docstring-feature",
|
166
|
+
"uri": "features/doc_string.feature",
|
212
167
|
"keyword": "Feature",
|
213
|
-
"name": "A
|
168
|
+
"name": "A DocString feature",
|
214
169
|
"line": 1,
|
215
170
|
"description": "",
|
216
171
|
"elements": [
|
217
172
|
{
|
173
|
+
"id": "a-docstring-feature;",
|
218
174
|
"keyword": "Scenario",
|
219
175
|
"name": "",
|
220
176
|
"line": 3,
|
@@ -222,20 +178,20 @@ Feature: JSON output formatter
|
|
222
178
|
"type": "scenario",
|
223
179
|
"steps": [
|
224
180
|
{
|
225
|
-
"keyword": "
|
226
|
-
"name": "I
|
181
|
+
"keyword": "Then ",
|
182
|
+
"name": "I should fail with",
|
227
183
|
"line": 4,
|
228
|
-
"
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
],
|
184
|
+
"doc_string": {
|
185
|
+
"content_type": "",
|
186
|
+
"value": "a string",
|
187
|
+
"line": 5
|
188
|
+
},
|
234
189
|
"match": {
|
235
|
-
"location": "features/step_definitions/
|
190
|
+
"location": "features/step_definitions/doc_string_steps.rb:1"
|
236
191
|
},
|
237
192
|
"result": {
|
238
|
-
"status": "
|
193
|
+
"status": "failed",
|
194
|
+
"error_message": "a string (RuntimeError)\n./features/step_definitions/doc_string_steps.rb:2:in `/I should fail with/'\nfeatures/doc_string.feature:4:in `Then I should fail with'"
|
239
195
|
}
|
240
196
|
}
|
241
197
|
]
|
@@ -243,6 +199,50 @@ Feature: JSON output formatter
|
|
243
199
|
]
|
244
200
|
}
|
245
201
|
]
|
246
|
-
|
202
|
+
"""
|
247
203
|
|
248
|
-
|
204
|
+
Scenario: embedding screenshot
|
205
|
+
When I run cucumber "-b --format json features/embed.feature"
|
206
|
+
Then it should pass with JSON:
|
207
|
+
"""
|
208
|
+
[
|
209
|
+
{
|
210
|
+
"uri": "features/embed.feature",
|
211
|
+
"id": "a-screenshot-feature",
|
212
|
+
"keyword": "Feature",
|
213
|
+
"name": "A screenshot feature",
|
214
|
+
"line": 1,
|
215
|
+
"description": "",
|
216
|
+
"elements": [
|
217
|
+
{
|
218
|
+
"id": "a-screenshot-feature;",
|
219
|
+
"keyword": "Scenario",
|
220
|
+
"name": "",
|
221
|
+
"line": 3,
|
222
|
+
"description": "",
|
223
|
+
"type": "scenario",
|
224
|
+
"steps": [
|
225
|
+
{
|
226
|
+
"keyword": "Given ",
|
227
|
+
"name": "I embed a screenshot",
|
228
|
+
"line": 4,
|
229
|
+
"embeddings": [
|
230
|
+
{
|
231
|
+
"mime_type": "image/png",
|
232
|
+
"data": "Zm9v"
|
233
|
+
}
|
234
|
+
],
|
235
|
+
"match": {
|
236
|
+
"location": "features/step_definitions/steps.rb:29"
|
237
|
+
},
|
238
|
+
"result": {
|
239
|
+
"status": "passed"
|
240
|
+
}
|
241
|
+
}
|
242
|
+
]
|
243
|
+
}
|
244
|
+
]
|
245
|
+
}
|
246
|
+
]
|
247
|
+
|
248
|
+
"""
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Feature: Nested Steps
|
2
|
+
|
3
|
+
|
4
|
+
Background:
|
5
|
+
Given a scenario with a step that looks like this:
|
6
|
+
"""gherkin
|
7
|
+
Given two turtles
|
8
|
+
"""
|
9
|
+
And a step definition that looks like this:
|
10
|
+
"""ruby
|
11
|
+
Given /a turtle/ do
|
12
|
+
puts "turtle!"
|
13
|
+
end
|
14
|
+
"""
|
15
|
+
|
16
|
+
Scenario: Use #steps to call several steps at once
|
17
|
+
Given a step definition that looks like this:
|
18
|
+
"""ruby
|
19
|
+
Given /two turtles/ do
|
20
|
+
steps %{
|
21
|
+
Given a turtle
|
22
|
+
And a turtle
|
23
|
+
}
|
24
|
+
end
|
25
|
+
"""
|
26
|
+
When I run the feature with the progress formatter
|
27
|
+
Then the output should contain:
|
28
|
+
"""
|
29
|
+
turtle!
|
30
|
+
|
31
|
+
turtle!
|
32
|
+
|
33
|
+
"""
|
34
|
+
|
35
|
+
Scenario: Use #step to call a single step
|
36
|
+
Given a step definition that looks like this:
|
37
|
+
"""ruby
|
38
|
+
Given /two turtles/ do
|
39
|
+
step "a turtle"
|
40
|
+
step "a turtle"
|
41
|
+
end
|
42
|
+
"""
|
43
|
+
When I run the feature with the progress formatter
|
44
|
+
Then the output should contain:
|
45
|
+
"""
|
46
|
+
turtle!
|
47
|
+
|
48
|
+
turtle!
|
49
|
+
|
50
|
+
"""
|
51
|
+
|
52
|
+
Scenario: Use deprecated i18n methods
|
53
|
+
Given a step definition that looks like this:
|
54
|
+
"""ruby
|
55
|
+
Given /two turtles/ do
|
56
|
+
Given "a turtle"
|
57
|
+
end
|
58
|
+
"""
|
59
|
+
When I run the feature with the progress formatter
|
60
|
+
Then the output should contain "WARNING"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Rerun formatter
|
2
|
+
For details see https://github.com/cucumber/cucumber/issues/57
|
3
|
+
|
4
|
+
Background:
|
5
|
+
Given a file named "features/one_passing_one_failing.feature" with:
|
6
|
+
"""
|
7
|
+
Feature: One passing example, one failing example
|
8
|
+
|
9
|
+
Scenario Outline:
|
10
|
+
Given a <certain> step
|
11
|
+
|
12
|
+
Examples:
|
13
|
+
|certain|
|
14
|
+
|passing|
|
15
|
+
|failing|
|
16
|
+
|
17
|
+
"""
|
18
|
+
And a file named "features/step_definitions/steps.rb" with:
|
19
|
+
"""
|
20
|
+
Given /a passing step/ do
|
21
|
+
#does nothing
|
22
|
+
end
|
23
|
+
|
24
|
+
Given /a failing step/ do
|
25
|
+
fail
|
26
|
+
end
|
27
|
+
"""
|
28
|
+
|
29
|
+
Scenario: Handle examples with the rerun formatter
|
30
|
+
When I run cucumber "features/one_passing_one_failing.feature -r features -f rerun"
|
31
|
+
Then it should fail with:
|
32
|
+
"""
|
33
|
+
features/one_passing_one_failing.feature:9
|
34
|
+
"""
|
35
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Feature: Run specific scenarios
|
2
|
+
|
3
|
+
You can choose to run a specific scenario using the file:line format
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given a file named "features/step_definitions/steps.rb" with:
|
7
|
+
"""
|
8
|
+
Given(/pass/) {}
|
9
|
+
Given(/fail/) { raise "Failed" }
|
10
|
+
"""
|
11
|
+
|
12
|
+
Scenario: Two scenarios, run just one of them
|
13
|
+
Given a file named "features/test.feature" with:
|
14
|
+
"""
|
15
|
+
Feature:
|
16
|
+
Scenario:
|
17
|
+
Given this is undefined
|
18
|
+
|
19
|
+
Scenario: Hit
|
20
|
+
Given this passes
|
21
|
+
"""
|
22
|
+
When I run `cucumber features/test.feature:5 -f progress`
|
23
|
+
Then it should pass with:
|
24
|
+
"""
|
25
|
+
1 scenario (1 passed)
|
26
|
+
"""
|
27
|
+
|
28
|
+
Scenario: Single example from a scenario outline
|
29
|
+
Given a file named "features/test.feature" with:
|
30
|
+
"""
|
31
|
+
Feature:
|
32
|
+
Scenario Outline:
|
33
|
+
Given this <something>
|
34
|
+
|
35
|
+
Examples:
|
36
|
+
| something |
|
37
|
+
| is undefined |
|
38
|
+
| fails |
|
39
|
+
|
40
|
+
Scenario: Miss
|
41
|
+
Given this passes
|
42
|
+
"""
|
43
|
+
When I run `cucumber features/test.feature:8 -f progress`
|
44
|
+
Then it should fail with:
|
45
|
+
"""
|
46
|
+
1 scenario (1 failed)
|
47
|
+
"""
|