cucumber 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +30 -4
- data/Rakefile +11 -8
- data/VERSION.yml +1 -1
- data/bin/cucumber +1 -2
- data/cucumber.gemspec +40 -38
- data/examples/i18n/da/features/{summering.feature → sammenlaegning.feature} +5 -5
- data/examples/i18n/da/features/step_definitons/{kalkulator_steps.rb → lommeregner_steps.rb} +3 -3
- data/examples/i18n/da/lib/{kalkulator.rb → lommeregner.rb} +2 -2
- data/examples/tickets/Rakefile +5 -1
- data/examples/tickets/features.html +138 -0
- data/examples/watir/Rakefile +4 -0
- data/examples/watir/features/{step_definitons → step_definitions}/search_steps.rb +0 -0
- data/examples/watir/features/support/screenshots.rb +45 -0
- data/features/announce.feature +122 -0
- data/features/html_formatter/a.html +1 -1
- data/features/step_definitions/cucumber_steps.rb +1 -1
- data/features/step_definitions/wire_steps.rb +14 -0
- data/features/support/env.rb +1 -1
- data/features/support/fake_wire_server.rb +63 -0
- data/features/tag_logic.feature +226 -0
- data/features/wire_protocol.feature +177 -0
- data/lib/cucumber/ast/examples.rb +4 -0
- data/lib/cucumber/ast/feature_element.rb +2 -1
- data/lib/cucumber/ast/scenario_outline.rb +4 -0
- data/lib/cucumber/ast/table.rb +13 -8
- data/lib/cucumber/ast/tags.rb +56 -12
- data/lib/cucumber/ast/tree_walker.rb +6 -0
- data/lib/cucumber/cli/main.rb +7 -5
- data/lib/cucumber/cli/options.rb +19 -10
- data/lib/cucumber/filter.rb +1 -2
- data/lib/cucumber/formatter/ansicolor.rb +17 -2
- data/lib/cucumber/formatter/console.rb +50 -32
- data/lib/cucumber/formatter/html.rb +21 -1
- data/lib/cucumber/formatter/junit.rb +8 -0
- data/lib/cucumber/formatter/pretty.rb +3 -0
- data/lib/cucumber/formatter/summary.rb +35 -0
- data/lib/cucumber/formatter/usage.rb +4 -4
- data/lib/cucumber/rails/active_record.rb +18 -10
- data/lib/cucumber/rb_support/rb_language.rb +7 -2
- data/lib/cucumber/rb_support/rb_world.rb +4 -0
- data/lib/cucumber/step_match.rb +3 -2
- data/lib/cucumber/step_mother.rb +6 -1
- data/lib/cucumber/wire_support/connection.rb +42 -0
- data/lib/cucumber/wire_support/request_handler.rb +19 -0
- data/lib/cucumber/wire_support/wire_exception.rb +10 -0
- data/lib/cucumber/wire_support/wire_language.rb +52 -0
- data/lib/cucumber/wire_support/wire_packet.rb +34 -0
- data/lib/cucumber/wire_support/wire_protocol.rb +64 -0
- data/lib/cucumber/wire_support/wire_step_definition.rb +21 -0
- data/rails_generators/cucumber/cucumber_generator.rb +7 -4
- data/rails_generators/cucumber/templates/cucumber_environment.rb +4 -4
- data/rails_generators/cucumber/templates/version_check.rb +6 -4
- data/spec/cucumber/ast/table_spec.rb +11 -1
- data/spec/cucumber/ast/tags_spec.rb +29 -0
- data/spec/cucumber/cli/options_spec.rb +8 -4
- data/spec/cucumber/formatter/junit_spec.rb +11 -0
- data/spec/cucumber/step_match_spec.rb +11 -0
- data/spec/cucumber/wire_support/wire_language_spec.rb +47 -0
- data/spec/cucumber/wire_support/wire_packet_spec.rb +26 -0
- metadata +38 -36
- data/examples/cs/.gitignore +0 -1
- data/examples/cs/README.textile +0 -1
- data/examples/cs/Rakefile +0 -12
- data/examples/cs/compile.bat +0 -1
- data/examples/cs/features/addition.feature +0 -16
- data/examples/cs/features/step_definitons/calculator_steps.rb +0 -19
- data/examples/cs/src/demo/Calculator.cs +0 -20
- data/examples/java/.gitignore +0 -1
- data/examples/java/README.textile +0 -18
- data/examples/java/build.xml +0 -33
- data/examples/java/features/hello.feature +0 -11
- data/examples/java/features/step_definitons/hello_steps.rb +0 -23
- data/examples/java/features/step_definitons/tree_steps.rb +0 -14
- data/examples/java/features/tree.feature +0 -9
- data/examples/java/src/.gitignore +0 -1
- data/examples/java/src/cucumber/demo/.gitignore +0 -1
- data/examples/java/src/cucumber/demo/Hello.java +0 -16
- data/examples/pure_java/README.textile +0 -5
data/examples/watir/Rakefile
CHANGED
File without changes
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# This is an example of how you can set up screenshots for your
|
2
|
+
# browser testing. Just run cucumber with --format html --out report.html
|
3
|
+
#
|
4
|
+
# This examples currently only works on OS X, but adding support for other
|
5
|
+
# platform should be easy - as long as there is a command line tool to take
|
6
|
+
# a picture of the desktop.
|
7
|
+
module Screenshots
|
8
|
+
def add_screenshot
|
9
|
+
id = "screenshot-#{Time.new.to_i}"
|
10
|
+
take_screenshot(id)
|
11
|
+
embed("#{id}.png", "image/png")
|
12
|
+
end
|
13
|
+
|
14
|
+
if `which screencapture` =~ /screencapture/
|
15
|
+
# OS X
|
16
|
+
def take_screenshot(id)
|
17
|
+
`screencapture -t png #{id}.png`
|
18
|
+
end
|
19
|
+
else
|
20
|
+
# Other platforms...
|
21
|
+
def take_screenshot(id)
|
22
|
+
STDERR.puts "Sorry - no screenshots on your platform yet."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
After do
|
28
|
+
add_screenshot
|
29
|
+
end
|
30
|
+
|
31
|
+
# Other variants
|
32
|
+
#
|
33
|
+
# Only take screenshot on failures
|
34
|
+
#
|
35
|
+
# After do |scenario|
|
36
|
+
# add_screenshot if scenario.failed?
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# Only take screenshot for scenarios or features tagged @screenshot
|
40
|
+
#
|
41
|
+
# After(@screenshot) do
|
42
|
+
# add_screenshot
|
43
|
+
# end
|
44
|
+
|
45
|
+
World(Screenshots)
|
@@ -0,0 +1,122 @@
|
|
1
|
+
Feature: Delayed announcement
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a standard Cucumber project directory structure
|
5
|
+
And a file named "features/step_definitions/steps.rb" with:
|
6
|
+
"""
|
7
|
+
Given /^I use announce with text "(.*)"$/ do |ann|
|
8
|
+
announce(ann)
|
9
|
+
end
|
10
|
+
|
11
|
+
Given /^I use multiple announces$/ do
|
12
|
+
announce("Multiple")
|
13
|
+
announce("Announce")
|
14
|
+
end
|
15
|
+
|
16
|
+
Given /^I use announcement (.+) in line (.+) (?:with result (.+))$/ do |ann, line, result|
|
17
|
+
announce("Last announcement") if line == "3"
|
18
|
+
announce("Line: #{line}: #{ann}")
|
19
|
+
fail if result =~ /fail/i
|
20
|
+
end
|
21
|
+
|
22
|
+
Given /^I use announce and step fails$/ do
|
23
|
+
announce("Announce with fail")
|
24
|
+
fail
|
25
|
+
end
|
26
|
+
|
27
|
+
Given /^this step works$/ do
|
28
|
+
end
|
29
|
+
"""
|
30
|
+
And a file named "features/f.feature" with:
|
31
|
+
"""
|
32
|
+
Scenario: S
|
33
|
+
Given I use announce with text "Ann"
|
34
|
+
And this step works
|
35
|
+
|
36
|
+
Scenario: S2
|
37
|
+
Given I use multiple announces
|
38
|
+
And this step works
|
39
|
+
|
40
|
+
Scenario Outline: S3
|
41
|
+
Given I use announcement <ann> in line <line>
|
42
|
+
|
43
|
+
Examples:
|
44
|
+
| line | ann |
|
45
|
+
| 1 | anno1 |
|
46
|
+
| 2 | anno2 |
|
47
|
+
| 3 | anno3 |
|
48
|
+
|
49
|
+
Scenario: S4
|
50
|
+
Given I use announce and step fails
|
51
|
+
And this step works
|
52
|
+
|
53
|
+
Scenario Outline: s5
|
54
|
+
Given I use announcement <ann> in line <line> with result <result>
|
55
|
+
|
56
|
+
Examples:
|
57
|
+
| line | ann | result |
|
58
|
+
| 1 | anno1 | fail |
|
59
|
+
| 2 | anno2 | pass |
|
60
|
+
"""
|
61
|
+
|
62
|
+
Scenario: Delayed announcements feature
|
63
|
+
When I run cucumber --format pretty features/f.feature
|
64
|
+
Then the output should contain
|
65
|
+
"""
|
66
|
+
Scenario: S # features/f.feature:1
|
67
|
+
Given I use announce with text "Ann" # features/step_definitions/steps.rb:1
|
68
|
+
Ann
|
69
|
+
And this step works # features/step_definitions/steps.rb:21
|
70
|
+
|
71
|
+
Scenario: S2 # features/f.feature:5
|
72
|
+
Given I use multiple announces # features/step_definitions/steps.rb:5
|
73
|
+
Multiple
|
74
|
+
Announce
|
75
|
+
And this step works # features/step_definitions/steps.rb:21
|
76
|
+
|
77
|
+
Scenario Outline: S3 # features/f.feature:9
|
78
|
+
Given I use announcement <ann> in line <line> # features/f.feature:10
|
79
|
+
|
80
|
+
Examples:
|
81
|
+
| line | ann |
|
82
|
+
| 1 | anno1 |
|
83
|
+
| 2 | anno2 |
|
84
|
+
| 3 | anno3 |
|
85
|
+
|
86
|
+
Scenario: S4 # features/f.feature:18
|
87
|
+
Given I use announce and step fails # features/step_definitions/steps.rb:16
|
88
|
+
Announce with fail
|
89
|
+
(RuntimeError)
|
90
|
+
./features/step_definitions/steps.rb:18:in `/^I use announce and step fails$/'
|
91
|
+
features/f.feature:19:in `Given I use announce and step fails'
|
92
|
+
And this step works # features/step_definitions/steps.rb:21
|
93
|
+
|
94
|
+
Scenario Outline: s5 # features/f.feature:22
|
95
|
+
Given I use announcement <ann> in line <line> with result <result> # features/step_definitions/steps.rb:10
|
96
|
+
|
97
|
+
Examples:
|
98
|
+
| line | ann | result |
|
99
|
+
| 1 | anno1 | fail | Line: 1: anno1
|
100
|
+
(RuntimeError)
|
101
|
+
./features/step_definitions/steps.rb:13:in `/^I use announcement (.+) in line (.+) (?:with result (.+))$/'
|
102
|
+
features/f.feature:23:in `Given I use announcement <ann> in line <line> with result <result>'
|
103
|
+
| 2 | anno2 | pass | Line: 2: anno2
|
104
|
+
"""
|
105
|
+
|
106
|
+
Scenario: Non-delayed announcements feature (progress formatter)
|
107
|
+
When I run cucumber --format progress features/f.feature
|
108
|
+
Then the output should contain
|
109
|
+
"""
|
110
|
+
Ann
|
111
|
+
..
|
112
|
+
Multiple
|
113
|
+
|
114
|
+
Announce
|
115
|
+
..-UUUUUU
|
116
|
+
Announce with fail
|
117
|
+
F--
|
118
|
+
Line: 1: anno1
|
119
|
+
FFF
|
120
|
+
Line: 2: anno2
|
121
|
+
...
|
122
|
+
"""
|
@@ -180,4 +180,4 @@ features/search_sample.feature:13:in `Given <state> without a table'</pre>
|
|
180
180
|
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
181
181
|
features/search_sample.feature:25:in `Given <state> without a table'</pre></td></tr></table></div></div></div><div class="feature"><span class="tag">@sample_one</span><h2><span class="val">Feature: Tag samples</span></h2><p class="narrative"></p><div class="scenario"><span class="tag">@sample_two</span> <span class="tag">@sample_four</span><h3><span class="keyword">Scenario:</span> <span class="val">Passing</span></h3><ol><li class="step undefined" id="features_tags_sample_feature_6"><div><span class="keyword">Given</span> <span class="step val">missing</span></div></li></ol></div><div class="scenario outline"><span class="tag">@sample_three</span><h3><span class="keyword">Scenario Outline:</span> <span class="val"></span></h3><ol><li class="step skipped" id="features_tags_sample_feature_10"><div><span class="keyword">Given</span> <span class="step val"><state></span></div></li></ol><div class="examples"><h4><span class="keyword">Examples:</span> <span class="val"></span></h4><table><tr id="row_12"><th class="val skipped_param" id="row_12_0">state</th></tr><tr id="row_13"><td class="val undefined" id="row_13_0">missing</td></tr></table></div></div><div class="scenario"><span class="tag">@sample_three</span> <span class="tag">@sample_four</span><h3><span class="keyword">Scenario:</span> <span class="val">Skipped</span></h3><ol><li class="step undefined" id="features_tags_sample_feature_17"><div><span class="keyword">Given</span> <span class="step val">missing</span></div></li></ol></div></div><div class="feature"><span class="tag">@lots</span><h2><span class="val">Feature: Tons of cukes</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">Lots and lots</span></h3><ol><li class="step passed" id="features_tons_of_cukes_feature_4"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step failed" id="features_tons_of_cukes_feature_5"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div><pre class="failed">We already have 2 cukes! (RuntimeError)
|
182
182
|
./features/step_definitions/sample_steps.rb:28:in `/^'(.+)' cukes$/'
|
183
|
-
features/tons_of_cukes.feature:5:in `Given '2' cukes'</pre></li><li class="step skipped" id="features_tons_of_cukes_feature_6"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_7"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_8"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_9"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_10"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_11"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_12"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_13"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_14"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_15"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_16"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_17"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_18"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_19"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_20"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_21"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_22"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_23"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_24"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_25"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_26"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_27"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_28"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_29"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_30"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_31"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_32"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_33"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_34"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_35"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_36"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_37"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_38"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_39"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_40"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_41"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_42"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_43"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_44"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_45"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_46"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_47"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_48"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_49"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_50"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_51"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_52"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: undefined multiline args</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">pystring</span></h3><ol><li class="step undefined" id="features_undefined_multiline_args_feature_4"><div><span class="keyword">Given</span> <span class="step val">a pystring</span></div><pre class="val"> example</pre></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">table</span></h3><ol><li class="step undefined" id="features_undefined_multiline_args_feature_10"><div><span class="keyword">Given</span> <span class="step val">a table</span></div><table><tr id="row_11"><td class="val" id="row_11_0">table</td></tr><tr id="row_12"><td class="val" id="row_12_0">example</td></tr></table></li></ol></div></div><div class="duration">0m30.005s</div></div></body></html>
|
183
|
+
features/tons_of_cukes.feature:5:in `Given '2' cukes'</pre></li><li class="step skipped" id="features_tons_of_cukes_feature_6"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_7"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_8"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_9"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_10"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_11"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_12"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_13"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_14"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_15"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_16"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_17"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_18"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_19"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_20"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_21"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_22"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_23"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_24"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_25"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_26"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_27"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_28"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_29"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_30"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_31"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_32"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_33"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_34"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_35"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_36"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_37"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_38"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_39"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_40"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_41"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_42"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_43"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_44"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_45"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_46"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_47"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_48"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_49"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_50"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_51"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li><li class="step skipped" id="features_tons_of_cukes_feature_52"><div><span class="keyword">Given</span> <span class="step val">'<span class="param">2</span>' cukes</span></div></li></ol></div></div><div class="feature"><h2><span class="val">Feature: undefined multiline args</span></h2><p class="narrative"></p><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">pystring</span></h3><ol><li class="step undefined" id="features_undefined_multiline_args_feature_4"><div><span class="keyword">Given</span> <span class="step val">a pystring</span></div><pre class="val"> example</pre></li></ol></div><div class="scenario"><h3><span class="keyword">Scenario:</span> <span class="val">table</span></h3><ol><li class="step undefined" id="features_undefined_multiline_args_feature_10"><div><span class="keyword">Given</span> <span class="step val">a table</span></div><table><tr id="row_11"><td class="val" id="row_11_0">table</td></tr><tr id="row_12"><td class="val" id="row_12_0">example</td></tr></table></li></ol></div></div><div class="summary">43 scenarios (10 failed, 2 skipped, 12 undefined, 19 passed)</div><div class="summary">131 steps (10 failed, 60 skipped, 16 undefined, 45 passed)</div><div class="duration">0m30.005s</div></div></body></html>
|
@@ -66,8 +66,8 @@ Then /^it should (fail|pass)$/ do |success|
|
|
66
66
|
end
|
67
67
|
|
68
68
|
Then /^it should (fail|pass) with$/ do |success, output|
|
69
|
-
last_stdout.should == output
|
70
69
|
Then("it should #{success}")
|
70
|
+
last_stdout.should == output
|
71
71
|
end
|
72
72
|
|
73
73
|
Then /^the output should contain$/ do |text|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Given /^there is a wire server running on port (\d+) which understands the following protocol:$/ do |port, table|
|
2
|
+
protocol = table.hashes
|
3
|
+
in_current_dir do
|
4
|
+
@wire_pid = fork do
|
5
|
+
@server = FakeWireServer.new(port.to_i, protocol)
|
6
|
+
@server.run
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
After('@wire') do
|
12
|
+
Process.kill('KILL', @wire_pid)
|
13
|
+
Process.wait
|
14
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -6,7 +6,7 @@ require 'forwardable'
|
|
6
6
|
begin
|
7
7
|
require 'spork'
|
8
8
|
rescue Gem::LoadError => ex
|
9
|
-
gem 'spork', '>= 0.
|
9
|
+
gem 'spork', '>= 0.7.3' # Ensure correct spork version number to avoid false-negatives.
|
10
10
|
end
|
11
11
|
|
12
12
|
class CucumberWorld
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class FakeWireServer
|
5
|
+
def initialize(port, protocol_table)
|
6
|
+
@port, @protocol_table = port, protocol_table
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
@server = TCPServer.open(@port)
|
11
|
+
loop { handle_connections }
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def handle_connections
|
17
|
+
Thread.start(@server.accept) { |socket| open_session_on socket }
|
18
|
+
end
|
19
|
+
|
20
|
+
def open_session_on(socket)
|
21
|
+
begin
|
22
|
+
SocketSession.new(socket, @protocol_table).start
|
23
|
+
rescue Exception => e
|
24
|
+
raise e
|
25
|
+
ensure
|
26
|
+
socket.close
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class SocketSession
|
31
|
+
def initialize(socket, protocol)
|
32
|
+
@socket = socket
|
33
|
+
@protocol = protocol
|
34
|
+
end
|
35
|
+
|
36
|
+
def start
|
37
|
+
while message = @socket.gets
|
38
|
+
handle(message)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def handle(data)
|
45
|
+
if protocol_entry = response_to(data.strip)
|
46
|
+
send_response(protocol_entry['response'])
|
47
|
+
else
|
48
|
+
serialized_exception = { :message => "Not understood: #{data}", :backtrace => [] }
|
49
|
+
send_response(['fail', serialized_exception ].to_json)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def response_to(data)
|
54
|
+
@protocol.detect do |entry|
|
55
|
+
JSON.parse(entry['request']) == JSON.parse(data)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def send_response(response)
|
60
|
+
@socket.puts response + "\n"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,226 @@
|
|
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 standard Cucumber project directory structure
|
8
|
+
And a file named "features/tagulicious.feature" with:
|
9
|
+
"""
|
10
|
+
Feature: Sample
|
11
|
+
|
12
|
+
@one @three
|
13
|
+
Scenario: Example
|
14
|
+
Given passing
|
15
|
+
|
16
|
+
@one
|
17
|
+
Scenario: Another Example
|
18
|
+
Given passing
|
19
|
+
|
20
|
+
@three
|
21
|
+
Scenario: Yet another Example
|
22
|
+
Given passing
|
23
|
+
|
24
|
+
@ignore
|
25
|
+
Scenario: And yet another Example
|
26
|
+
"""
|
27
|
+
|
28
|
+
Scenario: ANDing tags
|
29
|
+
When I run cucumber -q -t @one,@three features/tagulicious.feature
|
30
|
+
Then it should pass
|
31
|
+
And the output should contain
|
32
|
+
"""
|
33
|
+
Feature: Sample
|
34
|
+
|
35
|
+
@one @three
|
36
|
+
Scenario: Example
|
37
|
+
Given passing
|
38
|
+
|
39
|
+
1 scenario (1 undefined)
|
40
|
+
1 step (1 undefined)
|
41
|
+
|
42
|
+
"""
|
43
|
+
|
44
|
+
Scenario: ORing tags
|
45
|
+
When I run cucumber -q -t @one -t @three features/tagulicious.feature
|
46
|
+
Then it should pass
|
47
|
+
And the output should contain
|
48
|
+
"""
|
49
|
+
Feature: Sample
|
50
|
+
|
51
|
+
@one @three
|
52
|
+
Scenario: Example
|
53
|
+
Given passing
|
54
|
+
|
55
|
+
@one
|
56
|
+
Scenario: Another Example
|
57
|
+
Given passing
|
58
|
+
|
59
|
+
@three
|
60
|
+
Scenario: Yet another Example
|
61
|
+
Given passing
|
62
|
+
|
63
|
+
3 scenarios (3 undefined)
|
64
|
+
3 steps (3 undefined)
|
65
|
+
|
66
|
+
"""
|
67
|
+
|
68
|
+
Scenario: Before hooks ORing
|
69
|
+
Given a file named "features/support/hooks.rb" with:
|
70
|
+
"""
|
71
|
+
Before('@one', '@three') do
|
72
|
+
raise 'boom'
|
73
|
+
end
|
74
|
+
"""
|
75
|
+
When I run cucumber -q features/tagulicious.feature
|
76
|
+
Then it should fail with
|
77
|
+
"""
|
78
|
+
Feature: Sample
|
79
|
+
|
80
|
+
@one @three
|
81
|
+
Scenario: Example
|
82
|
+
boom (RuntimeError)
|
83
|
+
./features/support/hooks.rb:2:in `Before'
|
84
|
+
Given passing
|
85
|
+
|
86
|
+
@one
|
87
|
+
Scenario: Another Example
|
88
|
+
boom (RuntimeError)
|
89
|
+
./features/support/hooks.rb:2:in `Before'
|
90
|
+
Given passing
|
91
|
+
|
92
|
+
@three
|
93
|
+
Scenario: Yet another Example
|
94
|
+
boom (RuntimeError)
|
95
|
+
./features/support/hooks.rb:2:in `Before'
|
96
|
+
Given passing
|
97
|
+
|
98
|
+
@ignore
|
99
|
+
Scenario: And yet another Example
|
100
|
+
|
101
|
+
Failing Scenarios:
|
102
|
+
cucumber features/tagulicious.feature:4 # Scenario: Example
|
103
|
+
cucumber features/tagulicious.feature:8 # Scenario: Another Example
|
104
|
+
cucumber features/tagulicious.feature:12 # Scenario: Yet another Example
|
105
|
+
|
106
|
+
4 scenarios (3 failed, 1 passed)
|
107
|
+
3 steps (3 undefined)
|
108
|
+
|
109
|
+
"""
|
110
|
+
|
111
|
+
Scenario: Before hooks ANDing
|
112
|
+
Given a file named "features/support/hooks.rb" with:
|
113
|
+
"""
|
114
|
+
Before('@one,@three') do
|
115
|
+
raise 'boom'
|
116
|
+
end
|
117
|
+
"""
|
118
|
+
When I run cucumber -q features/tagulicious.feature
|
119
|
+
Then it should fail with
|
120
|
+
"""
|
121
|
+
Feature: Sample
|
122
|
+
|
123
|
+
@one @three
|
124
|
+
Scenario: Example
|
125
|
+
boom (RuntimeError)
|
126
|
+
./features/support/hooks.rb:2:in `Before'
|
127
|
+
Given passing
|
128
|
+
|
129
|
+
@one
|
130
|
+
Scenario: Another Example
|
131
|
+
Given passing
|
132
|
+
|
133
|
+
@three
|
134
|
+
Scenario: Yet another Example
|
135
|
+
Given passing
|
136
|
+
|
137
|
+
@ignore
|
138
|
+
Scenario: And yet another Example
|
139
|
+
|
140
|
+
Failing Scenarios:
|
141
|
+
cucumber features/tagulicious.feature:4 # Scenario: Example
|
142
|
+
|
143
|
+
4 scenarios (1 failed, 2 undefined, 1 passed)
|
144
|
+
3 steps (3 undefined)
|
145
|
+
|
146
|
+
"""
|
147
|
+
|
148
|
+
Scenario: After hooks ORing
|
149
|
+
Given a file named "features/support/hooks.rb" with:
|
150
|
+
"""
|
151
|
+
After('@one', '@three') do
|
152
|
+
raise 'boom'
|
153
|
+
end
|
154
|
+
"""
|
155
|
+
When I run cucumber -q features/tagulicious.feature
|
156
|
+
Then it should fail with
|
157
|
+
"""
|
158
|
+
Feature: Sample
|
159
|
+
|
160
|
+
@one @three
|
161
|
+
Scenario: Example
|
162
|
+
Given passing
|
163
|
+
boom (RuntimeError)
|
164
|
+
./features/support/hooks.rb:2:in `After'
|
165
|
+
|
166
|
+
@one
|
167
|
+
Scenario: Another Example
|
168
|
+
Given passing
|
169
|
+
boom (RuntimeError)
|
170
|
+
./features/support/hooks.rb:2:in `After'
|
171
|
+
|
172
|
+
@three
|
173
|
+
Scenario: Yet another Example
|
174
|
+
Given passing
|
175
|
+
boom (RuntimeError)
|
176
|
+
./features/support/hooks.rb:2:in `After'
|
177
|
+
|
178
|
+
@ignore
|
179
|
+
Scenario: And yet another Example
|
180
|
+
|
181
|
+
Failing Scenarios:
|
182
|
+
cucumber features/tagulicious.feature:4 # Scenario: Example
|
183
|
+
cucumber features/tagulicious.feature:8 # Scenario: Another Example
|
184
|
+
cucumber features/tagulicious.feature:12 # Scenario: Yet another Example
|
185
|
+
|
186
|
+
4 scenarios (3 failed, 1 passed)
|
187
|
+
3 steps (3 undefined)
|
188
|
+
|
189
|
+
"""
|
190
|
+
|
191
|
+
Scenario: After hooks ANDing
|
192
|
+
Given a file named "features/support/hooks.rb" with:
|
193
|
+
"""
|
194
|
+
After('@one,@three') do
|
195
|
+
raise 'boom'
|
196
|
+
end
|
197
|
+
"""
|
198
|
+
When I run cucumber -q features/tagulicious.feature
|
199
|
+
Then it should fail with
|
200
|
+
"""
|
201
|
+
Feature: Sample
|
202
|
+
|
203
|
+
@one @three
|
204
|
+
Scenario: Example
|
205
|
+
Given passing
|
206
|
+
boom (RuntimeError)
|
207
|
+
./features/support/hooks.rb:2:in `After'
|
208
|
+
|
209
|
+
@one
|
210
|
+
Scenario: Another Example
|
211
|
+
Given passing
|
212
|
+
|
213
|
+
@three
|
214
|
+
Scenario: Yet another Example
|
215
|
+
Given passing
|
216
|
+
|
217
|
+
@ignore
|
218
|
+
Scenario: And yet another Example
|
219
|
+
|
220
|
+
Failing Scenarios:
|
221
|
+
cucumber features/tagulicious.feature:4 # Scenario: Example
|
222
|
+
|
223
|
+
4 scenarios (1 failed, 2 undefined, 1 passed)
|
224
|
+
3 steps (3 undefined)
|
225
|
+
|
226
|
+
"""
|