cucumber 0.9.4 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/History.txt +16 -0
- data/bin/cucumber +7 -1
- data/cucumber.gemspec +5 -4
- data/cucumber.yml +1 -1
- data/examples/sinatra/features/support/env.rb +1 -4
- data/features/background.feature +284 -95
- data/features/custom_formatter.feature +3 -73
- data/features/execute_with_tag_filter.feature +63 -0
- data/features/{negative_tagged_hooks.feature → hooks.feature} +5 -6
- data/features/json_formatter.feature +161 -245
- data/features/stats_formatters.feature +70 -0
- data/features/step_definitions/cucumber_steps.rb +5 -163
- data/features/support/env.rb +23 -149
- data/features/{tag_logic.feature → tagged_hooks.feature} +11 -52
- data/gem_tasks/{features.rake → cucumber.rake} +6 -1
- data/{features → legacy_features}/announce.feature +0 -0
- data/{features → legacy_features}/api/list_step_defs_as_json.feature +0 -0
- data/{features → legacy_features}/api/run_cli_main_with_existing_runtime.feature +0 -0
- data/{features → legacy_features}/around_hooks.feature +0 -0
- data/{features → legacy_features}/bug_371.feature +0 -0
- data/{features → legacy_features}/bug_464.feature +0 -0
- data/{features → legacy_features}/bug_475.feature +0 -0
- data/{features → legacy_features}/bug_585_tab_indentation.feature +0 -0
- data/{features → legacy_features}/bug_600.feature +0 -0
- data/{features → legacy_features}/call_steps_from_stepdefs.feature +0 -0
- data/{features → legacy_features}/cucumber_cli.feature +9 -9
- data/{features → legacy_features}/cucumber_cli_outlines.feature +0 -0
- data/{features → legacy_features}/default_snippets.feature +0 -0
- data/{features → legacy_features}/diffing.feature +0 -0
- data/{features → legacy_features}/drb_server_integration.feature +0 -0
- data/{features → legacy_features}/exception_in_after_block.feature +0 -0
- data/{features → legacy_features}/exception_in_after_step_block.feature +0 -0
- data/{features → legacy_features}/exception_in_before_block.feature +0 -0
- data/{features → legacy_features}/exclude_files.feature +0 -0
- data/{features → legacy_features}/expand.feature +0 -0
- data/{features → legacy_features}/html_formatter.feature +0 -0
- data/{features → legacy_features}/html_formatter/a.html +0 -0
- data/{features → legacy_features}/junit_formatter.feature +0 -0
- data/{features → legacy_features}/language_from_header.feature +0 -0
- data/{features → legacy_features}/language_help.feature +0 -0
- data/{features → legacy_features}/listener_debugger_formatter.feature +0 -0
- data/legacy_features/multiline_names.feature +44 -0
- data/{features → legacy_features}/post_configuration_hook.feature +0 -0
- data/{features → legacy_features}/profiles.feature +0 -0
- data/{features → legacy_features}/rake_task.feature +0 -0
- data/{features → legacy_features}/report_called_undefined_steps.feature +0 -0
- data/{features → legacy_features}/rerun_formatter.feature +0 -0
- data/{features → legacy_features}/simplest.feature +0 -0
- data/{features → legacy_features}/snippet.feature +0 -0
- data/{features → legacy_features}/snippets_when_using_star_keyword.feature +0 -0
- data/legacy_features/step_definitions/cucumber_steps.rb +168 -0
- data/{features → legacy_features}/step_definitions/extra_steps.rb +0 -0
- data/{features → legacy_features}/step_definitions/simplest_steps.rb +0 -0
- data/{features → legacy_features}/step_definitions/wire_steps.rb +1 -0
- data/legacy_features/support/env.rb +157 -0
- data/{features → legacy_features}/support/env.rb.simplest +0 -0
- data/{features → legacy_features}/support/fake_wire_server.rb +0 -0
- data/{features → legacy_features}/table_diffing.feature +0 -0
- data/{features → legacy_features}/table_mapping.feature +0 -0
- data/{features → legacy_features}/transform.feature +0 -0
- data/{features → legacy_features}/unicode_table.feature +0 -0
- data/{features → legacy_features}/wire_protocol.feature +1 -1
- data/{features → legacy_features}/wire_protocol_table_diffing.feature +0 -0
- data/{features → legacy_features}/wire_protocol_tags.feature +0 -0
- data/{features → legacy_features}/wire_protocol_timeouts.feature +0 -0
- data/{features → legacy_features}/work_in_progress.feature +0 -0
- data/lib/cucumber/ast/examples.rb +5 -0
- data/lib/cucumber/ast/feature.rb +5 -0
- data/lib/cucumber/ast/feature_element.rb +5 -0
- data/lib/cucumber/ast/scenario_outline.rb +9 -4
- data/lib/cucumber/ast/step.rb +5 -0
- data/lib/cucumber/ast/step_invocation.rb +4 -0
- data/lib/cucumber/ast/table.rb +3 -3
- data/lib/cucumber/ast/tree_walker.rb +1 -39
- data/lib/cucumber/cli/main.rb +1 -6
- data/lib/cucumber/cli/options.rb +1 -2
- data/lib/cucumber/formatter/ansicolor.rb +2 -4
- data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +84 -0
- data/lib/cucumber/formatter/gpretty.rb +24 -0
- data/lib/cucumber/formatter/html.rb +1 -1
- data/lib/cucumber/formatter/io.rb +2 -4
- data/lib/cucumber/formatter/json.rb +15 -152
- data/lib/cucumber/formatter/json_pretty.rb +5 -6
- data/lib/cucumber/formatter/unicode.rb +41 -20
- data/lib/cucumber/parser/gherkin_builder.rb +7 -1
- data/lib/cucumber/platform.rb +1 -1
- data/lib/cucumber/step_match.rb +5 -1
- data/spec/cucumber/ast/scenario_outline_spec.rb +11 -8
- data/spec/cucumber/ast/table_spec.rb +6 -1
- data/spec/cucumber/cli/main_spec.rb +4 -1
- metadata +105 -132
- data/features/multiline_names.feature +0 -44
- data/features/usage_and_stepdefs_formatter.feature +0 -169
- data/fixtures/json/features/pystring.feature +0 -8
- data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +0 -12
- data/fixtures/self_test/features/background/background_with_name.feature +0 -7
- data/fixtures/self_test/features/background/failing_background.feature +0 -12
- data/fixtures/self_test/features/background/failing_background_after_success.feature +0 -11
- data/fixtures/self_test/features/background/multiline_args_background.feature +0 -32
- data/fixtures/self_test/features/background/passing_background.feature +0 -10
- data/fixtures/self_test/features/background/pending_background.feature +0 -10
- data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +0 -16
- data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +0 -16
- data/lib/cucumber/formatter/color_io.rb +0 -23
- data/lib/cucumber/formatter/tag_cloud.rb +0 -35
- data/spec/cucumber/formatter/color_io_spec.rb +0 -29
@@ -1,18 +1,7 @@
|
|
1
1
|
Feature: Custom Formatter
|
2
2
|
|
3
|
-
Scenario: count tags
|
4
|
-
When I run cucumber --format Cucumber::Formatter::TagCloud features
|
5
|
-
Then STDERR should be empty
|
6
|
-
Then it should fail with
|
7
|
-
"""
|
8
|
-
| @after_file | @background_tagged_before_on_outline | @four | @lots | @one | @sample_four | @sample_one | @sample_three | @sample_two | @three | @two |
|
9
|
-
| 1 | 1 | 1 | 1 | 1 | 2 | 1 | 2 | 1 | 2 | 1 |
|
10
|
-
|
11
|
-
"""
|
12
|
-
|
13
3
|
Scenario: my own formatter
|
14
|
-
Given a
|
15
|
-
And a file named "features/f.feature" with:
|
4
|
+
Given a file named "features/f.feature" with:
|
16
5
|
"""
|
17
6
|
Feature: I'll use my own
|
18
7
|
because I'm worth it
|
@@ -43,69 +32,10 @@ Feature: Custom Formatter
|
|
43
32
|
end
|
44
33
|
end
|
45
34
|
"""
|
46
|
-
When I run cucumber features/f.feature --format Ze::Formator
|
47
|
-
Then
|
48
|
-
Then it should pass with
|
35
|
+
When I run cucumber "features/f.feature --format Ze::Formator"
|
36
|
+
Then it should pass with exactly:
|
49
37
|
"""
|
50
38
|
I'LL USE MY OWN
|
51
39
|
JUST PRINT ME
|
52
40
|
|
53
41
|
"""
|
54
|
-
|
55
|
-
Scenario: Legacy pre-0.7.0 formatter
|
56
|
-
Given a standard Cucumber project directory structure
|
57
|
-
And a file named "features/f.feature" with:
|
58
|
-
"""
|
59
|
-
Feature: We like old cukes
|
60
|
-
Scenario Outline: just print me
|
61
|
-
Given this step works
|
62
|
-
|
63
|
-
Examples: print me too
|
64
|
-
|foo|
|
65
|
-
|bar|
|
66
|
-
"""
|
67
|
-
And a file named "features/step_definitions/steps.rb" with:
|
68
|
-
"""
|
69
|
-
Given /^this step works$/ do
|
70
|
-
end
|
71
|
-
"""
|
72
|
-
And a file named "features/support/legacy/formator.rb" with:
|
73
|
-
"""
|
74
|
-
module Legacy
|
75
|
-
class Formator
|
76
|
-
def initialize(step_mother, io, options)
|
77
|
-
@io = io
|
78
|
-
end
|
79
|
-
|
80
|
-
def feature_name(name)
|
81
|
-
@io.puts name
|
82
|
-
end
|
83
|
-
|
84
|
-
def scenario_name(keyword, name, file_colon_line, source_indent)
|
85
|
-
@io.puts "#{keyword} #{name}"
|
86
|
-
end
|
87
|
-
|
88
|
-
def examples_name(keyword, name)
|
89
|
-
@io.puts "#{keyword} #{name}"
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
"""
|
94
|
-
When I run cucumber features/f.feature --format Legacy::Formator
|
95
|
-
Then STDERR should be
|
96
|
-
"""
|
97
|
-
Legacy::Formator is using a deprecated formatter API. Starting with Cucumber 0.7.0 the signatures
|
98
|
-
that have changed are:
|
99
|
-
feature_name(keyword, name) # Two arguments. The keyword argument will not contain a colon.
|
100
|
-
scenario_name(keyword, name, file_colon_line, source_indent) # The keyword argument will not contain a colon.
|
101
|
-
examples_name(keyword, name) # The keyword argument will not contain a colon.
|
102
|
-
|
103
|
-
|
104
|
-
"""
|
105
|
-
Then it should pass with
|
106
|
-
"""
|
107
|
-
Feature: We like old cukes
|
108
|
-
Scenario Outline: just print me
|
109
|
-
Examples: print me too
|
110
|
-
|
111
|
-
"""
|
@@ -0,0 +1,63 @@
|
|
1
|
+
Feature: Tag logic
|
2
|
+
In order to conveniently run subsets of features
|
3
|
+
As a Cuker
|
4
|
+
I want to select features using logical AND/OR of tags
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a file named "features/tagulicious.feature" with:
|
8
|
+
"""
|
9
|
+
Feature: Sample
|
10
|
+
|
11
|
+
@one @three
|
12
|
+
Scenario: Example
|
13
|
+
Given passing
|
14
|
+
|
15
|
+
@one
|
16
|
+
Scenario: Another Example
|
17
|
+
Given passing
|
18
|
+
|
19
|
+
@three
|
20
|
+
Scenario: Yet another Example
|
21
|
+
Given passing
|
22
|
+
|
23
|
+
@ignore
|
24
|
+
Scenario: And yet another Example
|
25
|
+
"""
|
26
|
+
|
27
|
+
Scenario: ANDing tags
|
28
|
+
When I run "cucumber -q -t @one -t @three features/tagulicious.feature"
|
29
|
+
Then it should pass with:
|
30
|
+
"""
|
31
|
+
Feature: Sample
|
32
|
+
|
33
|
+
@one @three
|
34
|
+
Scenario: Example
|
35
|
+
Given passing
|
36
|
+
|
37
|
+
1 scenario (1 undefined)
|
38
|
+
1 step (1 undefined)
|
39
|
+
|
40
|
+
"""
|
41
|
+
|
42
|
+
Scenario: ORing tags
|
43
|
+
When I run "cucumber -q -t @one,@three features/tagulicious.feature"
|
44
|
+
Then it should pass with:
|
45
|
+
"""
|
46
|
+
Feature: Sample
|
47
|
+
|
48
|
+
@one @three
|
49
|
+
Scenario: Example
|
50
|
+
Given passing
|
51
|
+
|
52
|
+
@one
|
53
|
+
Scenario: Another Example
|
54
|
+
Given passing
|
55
|
+
|
56
|
+
@three
|
57
|
+
Scenario: Yet another Example
|
58
|
+
Given passing
|
59
|
+
|
60
|
+
3 scenarios (3 undefined)
|
61
|
+
3 steps (3 undefined)
|
62
|
+
|
63
|
+
"""
|
@@ -1,8 +1,7 @@
|
|
1
1
|
Feature: Tagged hooks
|
2
2
|
|
3
3
|
Background:
|
4
|
-
Given a
|
5
|
-
And a file named "features/step_definitions/steps.rb" with:
|
4
|
+
Given a file named "features/step_definitions/steps.rb" with:
|
6
5
|
"""
|
7
6
|
Given /^this step works$/ do; end
|
8
7
|
"""
|
@@ -24,8 +23,8 @@ Feature: Tagged hooks
|
|
24
23
|
"""
|
25
24
|
|
26
25
|
Scenario: omit tagged hook
|
27
|
-
When I run cucumber features/f.feature:2
|
28
|
-
Then it should fail with
|
26
|
+
When I run "cucumber features/f.feature:2"
|
27
|
+
Then it should fail with:
|
29
28
|
"""
|
30
29
|
Feature: With and without hooks
|
31
30
|
|
@@ -43,8 +42,8 @@ Feature: Tagged hooks
|
|
43
42
|
"""
|
44
43
|
|
45
44
|
Scenario: omit tagged hook
|
46
|
-
When I run cucumber features/f.feature:6
|
47
|
-
Then it should pass with
|
45
|
+
When I run "cucumber features/f.feature:6"
|
46
|
+
Then it should pass with:
|
48
47
|
"""
|
49
48
|
Feature: With and without hooks
|
50
49
|
|
@@ -1,225 +1,199 @@
|
|
1
1
|
Feature: JSON output formatter
|
2
|
-
In order to
|
3
|
-
|
4
|
-
Cucumber should be able to output JSON
|
2
|
+
In order to simplify processing of Cucumber features and results
|
3
|
+
Developers should be able to consume features as JSON
|
5
4
|
|
6
5
|
Background:
|
7
|
-
Given
|
6
|
+
Given a file named "features/one_passing_one_failing.feature" with:
|
7
|
+
"""
|
8
|
+
@a
|
9
|
+
Feature: One passing scenario, one failing scenario
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
@b
|
12
|
+
Scenario: Passing
|
13
|
+
Given a passing step
|
14
|
+
|
15
|
+
@c
|
16
|
+
Scenario: Failing
|
17
|
+
Given a failing step
|
18
|
+
"""
|
19
|
+
And a file named "features/step_definitions/steps.rb" with:
|
20
|
+
"""
|
21
|
+
Given /a passing step/ do
|
22
|
+
#does nothing
|
23
|
+
end
|
24
|
+
|
25
|
+
Given /a failing step/ do
|
26
|
+
fail
|
27
|
+
end
|
28
|
+
|
29
|
+
Given /a pending step/ do
|
30
|
+
pending
|
31
|
+
end
|
32
|
+
|
33
|
+
Given /^I add (\d+) and (\d+)$/ do |a,b|
|
34
|
+
@result = a.to_i + b.to_i
|
35
|
+
end
|
36
|
+
|
37
|
+
Then /^I the result should be (\d+)$/ do |c|
|
38
|
+
@result.should == c.to_i
|
39
|
+
end
|
40
|
+
|
41
|
+
Then /^I should see/ do |string|
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
Given /^I pass a table argument/ do |table|
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
Given /^I embed a screenshot/ do
|
50
|
+
File.open("screenshot.png", "w") { |file| file << "foo" }
|
51
|
+
embed "screenshot.png", "image/png"
|
52
|
+
end
|
14
53
|
"""
|
54
|
+
And a file named "features/embed.feature" with:
|
15
55
|
"""
|
16
|
-
|
56
|
+
Feature: A screenshot feature
|
57
|
+
|
58
|
+
Scenario:
|
59
|
+
Given I embed a screenshot
|
60
|
+
|
61
|
+
"""
|
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":\[/
|
17
66
|
|
18
67
|
Scenario: one feature, one passing scenario, one failing scenario
|
19
|
-
When I run cucumber --format
|
20
|
-
Then
|
21
|
-
And it should fail with JSON
|
68
|
+
When I run cucumber "--format json features/one_passing_one_failing.feature"
|
69
|
+
Then it should fail with JSON:
|
22
70
|
"""
|
23
71
|
{
|
24
72
|
"features": [
|
25
73
|
{
|
26
|
-
"
|
74
|
+
"keyword": "Feature",
|
27
75
|
"name": "One passing scenario, one failing scenario",
|
76
|
+
"line": 2,
|
77
|
+
"description": "",
|
28
78
|
"tags": [
|
29
|
-
|
79
|
+
{
|
80
|
+
"name": "@a",
|
81
|
+
"line": 1
|
82
|
+
}
|
30
83
|
],
|
31
84
|
"elements": [
|
32
85
|
{
|
33
|
-
"tags": [
|
34
|
-
"@b"
|
35
|
-
],
|
36
86
|
"keyword": "Scenario",
|
37
87
|
"name": "Passing",
|
38
|
-
"
|
88
|
+
"line": 5,
|
89
|
+
"description": "",
|
90
|
+
"tags": [
|
91
|
+
{
|
92
|
+
"name": "@b",
|
93
|
+
"line": 4
|
94
|
+
}
|
95
|
+
],
|
96
|
+
"type": "scenario",
|
39
97
|
"steps": [
|
40
98
|
{
|
41
|
-
"status": "passed",
|
42
99
|
"keyword": "Given ",
|
43
100
|
"name": "a passing step",
|
44
|
-
"
|
101
|
+
"line": 6,
|
102
|
+
"match": {
|
103
|
+
"location": "features/step_definitions/steps.rb:1"
|
104
|
+
},
|
105
|
+
"result": {
|
106
|
+
"status": "passed"
|
107
|
+
}
|
45
108
|
}
|
46
109
|
]
|
47
110
|
},
|
48
111
|
{
|
49
|
-
"tags": [
|
50
|
-
"@c"
|
51
|
-
],
|
52
112
|
"keyword": "Scenario",
|
53
113
|
"name": "Failing",
|
54
|
-
"
|
55
|
-
"
|
114
|
+
"line": 9,
|
115
|
+
"description": "",
|
116
|
+
"tags": [
|
56
117
|
{
|
57
|
-
"
|
58
|
-
|
59
|
-
"message": "",
|
60
|
-
"backtrace": [
|
61
|
-
"./features/step_definitions/steps.rb:6:in `/a failing step/'",
|
62
|
-
"features/one_passing_one_failing.feature:10:in `Given a failing step'"
|
63
|
-
]
|
64
|
-
},
|
65
|
-
"status": "failed",
|
66
|
-
"keyword": "Given ",
|
67
|
-
"name": "a failing step",
|
68
|
-
"file_colon_line": "features/step_definitions/steps.rb:5"
|
118
|
+
"name": "@c",
|
119
|
+
"line": 8
|
69
120
|
}
|
70
|
-
]
|
71
|
-
}
|
72
|
-
]
|
73
|
-
}
|
74
|
-
]
|
75
|
-
}
|
76
|
-
"""
|
77
|
-
|
78
|
-
Scenario: Tables
|
79
|
-
When I run cucumber --format json_pretty features/tables.feature
|
80
|
-
Then STDERR should be empty
|
81
|
-
And it should fail with JSON
|
82
|
-
"""
|
83
|
-
{
|
84
|
-
"features": [
|
85
|
-
{
|
86
|
-
"file": "features/tables.feature",
|
87
|
-
"name": "A scenario outline",
|
88
|
-
"tags": [
|
89
|
-
|
90
|
-
],
|
91
|
-
"elements": [
|
92
|
-
{
|
93
|
-
"tags": [
|
94
|
-
|
95
121
|
],
|
96
|
-
"
|
97
|
-
"name": "",
|
98
|
-
"file_colon_line": "features/tables.feature:3",
|
122
|
+
"type": "scenario",
|
99
123
|
"steps": [
|
100
124
|
{
|
101
|
-
"status": "skipped",
|
102
125
|
"keyword": "Given ",
|
103
|
-
"name": "
|
104
|
-
"
|
105
|
-
|
106
|
-
|
107
|
-
"status": "skipped",
|
108
|
-
"keyword": "When ",
|
109
|
-
"name": "I pass a table argument",
|
110
|
-
"file_colon_line": "features/step_definitions/steps.rb:25",
|
111
|
-
"table": [
|
112
|
-
{"cells":
|
113
|
-
[{"text":"foo", "status": null},
|
114
|
-
{"text":"bar", "status": null}]},
|
115
|
-
{"cells":
|
116
|
-
[{"text": "bar", "status": null},
|
117
|
-
{"text": "baz", "status": null}]}
|
118
|
-
]
|
119
|
-
},
|
120
|
-
{
|
121
|
-
"status": "skipped",
|
122
|
-
"keyword": "Then ",
|
123
|
-
"name": "I the result should be <c>",
|
124
|
-
"file_colon_line": "features/step_definitions/steps.rb:17"
|
125
|
-
}
|
126
|
-
],
|
127
|
-
"examples": {
|
128
|
-
"name": "Examples ",
|
129
|
-
"table": [
|
130
|
-
{
|
131
|
-
"cells": [
|
132
|
-
{
|
133
|
-
"text": "a",
|
134
|
-
"status": "skipped_param"
|
135
|
-
},
|
136
|
-
{
|
137
|
-
"text": "b",
|
138
|
-
"status": "skipped_param"
|
139
|
-
},
|
140
|
-
{
|
141
|
-
"text": "c",
|
142
|
-
"status": "skipped_param"
|
143
|
-
}
|
144
|
-
]
|
145
|
-
},
|
146
|
-
{
|
147
|
-
"cells": [
|
148
|
-
{
|
149
|
-
"text": "1",
|
150
|
-
"status": "passed"
|
151
|
-
},
|
152
|
-
{
|
153
|
-
"text": "2",
|
154
|
-
"status": "passed"
|
155
|
-
},
|
156
|
-
{
|
157
|
-
"text": "3",
|
158
|
-
"status": "passed"
|
159
|
-
}
|
160
|
-
]
|
126
|
+
"name": "a failing step",
|
127
|
+
"line": 10,
|
128
|
+
"match": {
|
129
|
+
"location": "features/step_definitions/steps.rb:5"
|
161
130
|
},
|
162
|
-
{
|
163
|
-
"
|
164
|
-
|
165
|
-
"text": "2",
|
166
|
-
"status": "passed"
|
167
|
-
},
|
168
|
-
{
|
169
|
-
"text": "3",
|
170
|
-
"status": "passed"
|
171
|
-
},
|
172
|
-
{
|
173
|
-
"text": "4",
|
174
|
-
"status": "failed"
|
175
|
-
}
|
176
|
-
],
|
177
|
-
"exception": {
|
178
|
-
"class": "RSpec::Expectations::ExpectationNotMetError",
|
179
|
-
"message": "expected: 4,\n got: 5 (using ==)",
|
180
|
-
"backtrace": [
|
181
|
-
"./features/step_definitions/steps.rb:18:in `/^I the result should be (\\d+)$/'",
|
182
|
-
"features/tables.feature:8:in `Then I the result should be <c>'"
|
183
|
-
]
|
184
|
-
}
|
131
|
+
"result": {
|
132
|
+
"status": "failed",
|
133
|
+
"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'"
|
185
134
|
}
|
186
|
-
|
187
|
-
|
135
|
+
}
|
136
|
+
]
|
188
137
|
}
|
189
138
|
]
|
190
139
|
}
|
191
140
|
]
|
192
141
|
}
|
142
|
+
|
193
143
|
"""
|
194
144
|
|
145
|
+
@announce
|
195
146
|
Scenario: pystring
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
147
|
+
Given a file named "features/pystring.feature" with:
|
148
|
+
"""
|
149
|
+
Feature: A pystring feature
|
150
|
+
|
151
|
+
Scenario:
|
152
|
+
Then I should fail with
|
153
|
+
\"\"\"
|
154
|
+
a string
|
155
|
+
\"\"\"
|
156
|
+
"""
|
157
|
+
And a file named "features/step_definitions/pystring_steps.rb" with:
|
158
|
+
"""
|
159
|
+
Then /I should fail with/ do |s|
|
160
|
+
raise s
|
161
|
+
end
|
162
|
+
"""
|
163
|
+
When I run cucumber "--format json features/pystring.feature"
|
164
|
+
Then it should fail with JSON:
|
165
|
+
"""
|
200
166
|
{
|
201
167
|
"features": [
|
202
168
|
{
|
203
|
-
"
|
204
|
-
"name": "A
|
205
|
-
"
|
206
|
-
|
207
|
-
],
|
169
|
+
"keyword": "Feature",
|
170
|
+
"name": "A pystring feature",
|
171
|
+
"line": 1,
|
172
|
+
"description": "",
|
208
173
|
"elements": [
|
209
174
|
{
|
210
|
-
"tags": [
|
211
|
-
|
212
|
-
],
|
213
175
|
"keyword": "Scenario",
|
214
176
|
"name": "",
|
215
|
-
"
|
177
|
+
"line": 3,
|
178
|
+
"description": "",
|
179
|
+
"type": "scenario",
|
216
180
|
"steps": [
|
217
181
|
{
|
218
|
-
"status": "passed",
|
219
182
|
"keyword": "Then ",
|
220
|
-
"name": "I should
|
221
|
-
"
|
222
|
-
"
|
183
|
+
"name": "I should fail with",
|
184
|
+
"line": 4,
|
185
|
+
"multiline_arg": {
|
186
|
+
"value": "a string",
|
187
|
+
"line": 5,
|
188
|
+
"type": "py_string"
|
189
|
+
},
|
190
|
+
"match": {
|
191
|
+
"location": "features/step_definitions/pystring_steps.rb:1"
|
192
|
+
},
|
193
|
+
"result": {
|
194
|
+
"status": "failed",
|
195
|
+
"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'"
|
196
|
+
}
|
223
197
|
}
|
224
198
|
]
|
225
199
|
}
|
@@ -227,102 +201,43 @@ Feature: JSON output formatter
|
|
227
201
|
}
|
228
202
|
]
|
229
203
|
}
|
230
|
-
|
231
|
-
|
232
|
-
Scenario: background
|
233
|
-
When I run cucumber --format json_pretty features/background.feature
|
234
|
-
Then STDERR should be empty
|
235
|
-
And it should fail with JSON
|
236
|
-
"""
|
237
|
-
{
|
238
|
-
"features": [
|
239
|
-
{
|
240
|
-
"file": "features/background.feature",
|
241
|
-
"name": "Feature with background",
|
242
|
-
"tags": [
|
243
|
-
|
244
|
-
],
|
245
|
-
"background": {
|
246
|
-
"steps": [
|
247
|
-
{
|
248
|
-
"status": "passed",
|
249
|
-
"keyword": "Given ",
|
250
|
-
"name": "a passing step",
|
251
|
-
"file_colon_line": "features/step_definitions/steps.rb:1"
|
252
|
-
}
|
253
|
-
]
|
254
|
-
},
|
255
|
-
"elements": [
|
256
|
-
{
|
257
|
-
"tags": [
|
258
|
-
|
259
|
-
],
|
260
|
-
"keyword": "Scenario",
|
261
|
-
"name": "",
|
262
|
-
"file_colon_line": "features/background.feature:6",
|
263
|
-
"steps": [
|
264
|
-
{
|
265
|
-
"status": "passed",
|
266
|
-
"keyword": "Given ",
|
267
|
-
"name": "a passing step",
|
268
|
-
"file_colon_line": "features/step_definitions/steps.rb:1"
|
269
|
-
},
|
270
|
-
{
|
271
|
-
"exception": {
|
272
|
-
"class": "RuntimeError",
|
273
|
-
"message": "",
|
274
|
-
"backtrace": [
|
275
|
-
"./features/step_definitions/steps.rb:6:in `/a failing step/'",
|
276
|
-
"features/background.feature:7:in `Given a failing step'"
|
277
|
-
]
|
278
|
-
},
|
279
|
-
"status": "failed",
|
280
|
-
"keyword": "Given ",
|
281
|
-
"name": "a failing step",
|
282
|
-
"file_colon_line": "features/step_definitions/steps.rb:5"
|
283
|
-
}
|
284
|
-
]
|
285
|
-
}
|
286
|
-
]
|
287
|
-
}
|
288
|
-
]
|
289
|
-
}
|
290
|
-
"""
|
204
|
+
"""
|
291
205
|
|
292
206
|
Scenario: embedding screenshot
|
293
|
-
When I run cucumber --format
|
294
|
-
Then
|
295
|
-
And it should pass with JSON
|
207
|
+
When I run cucumber "-b --format json features/embed.feature"
|
208
|
+
Then it should pass with JSON:
|
296
209
|
"""
|
297
210
|
{
|
298
211
|
"features": [
|
299
212
|
{
|
300
|
-
"
|
213
|
+
"keyword": "Feature",
|
301
214
|
"name": "A screenshot feature",
|
302
|
-
"
|
303
|
-
|
304
|
-
],
|
215
|
+
"line": 1,
|
216
|
+
"description": "",
|
305
217
|
"elements": [
|
306
218
|
{
|
307
|
-
"tags": [
|
308
|
-
|
309
|
-
],
|
310
219
|
"keyword": "Scenario",
|
311
220
|
"name": "",
|
312
|
-
"
|
221
|
+
"line": 3,
|
222
|
+
"description": "",
|
223
|
+
"type": "scenario",
|
313
224
|
"steps": [
|
314
225
|
{
|
315
|
-
"status": "passed",
|
316
226
|
"keyword": "Given ",
|
317
227
|
"name": "I embed a screenshot",
|
318
|
-
"
|
319
|
-
"
|
228
|
+
"line": 4,
|
229
|
+
"embeddings": [
|
320
230
|
{
|
321
|
-
"file": "tmp/screenshot.png",
|
322
231
|
"mime_type": "image/png",
|
323
|
-
"data": "Zm9v
|
232
|
+
"data": "Zm9v"
|
324
233
|
}
|
325
|
-
]
|
234
|
+
],
|
235
|
+
"match": {
|
236
|
+
"location": "features/step_definitions/steps.rb:29"
|
237
|
+
},
|
238
|
+
"result": {
|
239
|
+
"status": "passed"
|
240
|
+
}
|
326
241
|
}
|
327
242
|
]
|
328
243
|
}
|
@@ -330,4 +245,5 @@ Feature: JSON output formatter
|
|
330
245
|
}
|
331
246
|
]
|
332
247
|
}
|
248
|
+
|
333
249
|
"""
|