cucumber 0.8.5 → 0.8.6

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.
Files changed (181) hide show
  1. data/.rspec +1 -1
  2. data/LICENSE +1 -1
  3. data/Rakefile +5 -51
  4. data/bin/cucumber +7 -1
  5. data/cucumber.gemspec +463 -679
  6. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
  7. data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
  8. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +4 -7
  9. data/examples/i18n/ru/features/division.feature +2 -2
  10. data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
  11. data/examples/sinatra/features/support/env.rb +2 -5
  12. data/examples/v8/features/fibonacci.feature +1 -1
  13. data/examples/watir/features/step_definitions/search_steps.rb +1 -1
  14. data/features/background.feature +284 -95
  15. data/features/custom_formatter.feature +3 -73
  16. data/features/json_formatter.feature +160 -245
  17. data/features/step_definitions/cucumber_steps.rb +7 -153
  18. data/features/support/env.rb +18 -140
  19. data/fixtures/junit/features/pending.feature +3 -1
  20. data/fixtures/self_test/features/support/env.rb +8 -0
  21. data/fixtures/tickets/features.html +1 -1
  22. data/gem_tasks/examples.rake +1 -1
  23. data/lib/cucumber.rb +12 -0
  24. data/lib/cucumber/ast.rb +1 -1
  25. data/lib/cucumber/ast/background.rb +21 -5
  26. data/lib/cucumber/ast/examples.rb +12 -4
  27. data/lib/cucumber/ast/feature.rb +13 -5
  28. data/lib/cucumber/ast/feature_element.rb +9 -4
  29. data/lib/cucumber/ast/outline_table.rb +4 -4
  30. data/lib/cucumber/ast/scenario.rb +7 -5
  31. data/lib/cucumber/ast/scenario_outline.rb +23 -15
  32. data/lib/cucumber/ast/step.rb +5 -0
  33. data/lib/cucumber/ast/step_invocation.rb +21 -15
  34. data/lib/cucumber/ast/table.rb +14 -8
  35. data/lib/cucumber/ast/tree_walker.rb +10 -48
  36. data/lib/cucumber/cli/configuration.rb +33 -8
  37. data/lib/cucumber/cli/main.rb +20 -35
  38. data/lib/cucumber/cli/options.rb +8 -7
  39. data/lib/cucumber/cli/profile_loader.rb +2 -0
  40. data/lib/cucumber/core_ext/proc.rb +2 -1
  41. data/lib/cucumber/feature_file.rb +47 -15
  42. data/lib/cucumber/formatter/ansicolor.rb +3 -5
  43. data/lib/cucumber/formatter/console.rb +27 -23
  44. data/lib/cucumber/formatter/cucumber.css +34 -17
  45. data/lib/cucumber/formatter/cucumber.sass +173 -182
  46. data/lib/cucumber/formatter/html.rb +46 -11
  47. data/lib/cucumber/formatter/io.rb +2 -4
  48. data/lib/cucumber/formatter/json.rb +15 -152
  49. data/lib/cucumber/formatter/json_pretty.rb +5 -6
  50. data/lib/cucumber/formatter/junit.rb +28 -22
  51. data/lib/cucumber/formatter/pdf.rb +6 -6
  52. data/lib/cucumber/formatter/pretty.rb +5 -5
  53. data/lib/cucumber/formatter/rerun.rb +22 -11
  54. data/lib/cucumber/formatter/unicode.rb +41 -20
  55. data/lib/cucumber/js_support/js_dsl.js +4 -4
  56. data/lib/cucumber/js_support/js_language.rb +9 -5
  57. data/lib/cucumber/js_support/js_snippets.rb +2 -2
  58. data/lib/cucumber/language_support.rb +2 -2
  59. data/lib/cucumber/parser/gherkin_builder.rb +35 -30
  60. data/lib/cucumber/platform.rb +8 -8
  61. data/lib/cucumber/py_support/py_language.rb +2 -2
  62. data/lib/cucumber/rake/task.rb +80 -31
  63. data/lib/cucumber/rb_support/rb_dsl.rb +1 -0
  64. data/lib/cucumber/rb_support/rb_language.rb +10 -8
  65. data/lib/cucumber/rb_support/rb_step_definition.rb +8 -0
  66. data/lib/cucumber/rb_support/rb_transform.rb +17 -0
  67. data/lib/cucumber/rb_support/rb_world.rb +26 -18
  68. data/lib/cucumber/rspec/doubles.rb +3 -3
  69. data/lib/cucumber/step_match.rb +6 -2
  70. data/lib/cucumber/step_mother.rb +6 -427
  71. data/lib/cucumber/wire_support/configuration.rb +4 -1
  72. data/lib/cucumber/wire_support/wire_language.rb +3 -10
  73. data/spec/cucumber/ast/background_spec.rb +68 -6
  74. data/spec/cucumber/ast/feature_factory.rb +5 -4
  75. data/spec/cucumber/ast/feature_spec.rb +4 -4
  76. data/spec/cucumber/ast/outline_table_spec.rb +1 -1
  77. data/spec/cucumber/ast/scenario_outline_spec.rb +15 -11
  78. data/spec/cucumber/ast/scenario_spec.rb +4 -4
  79. data/spec/cucumber/ast/step_spec.rb +3 -3
  80. data/spec/cucumber/ast/table_spec.rb +38 -2
  81. data/spec/cucumber/ast/tree_walker_spec.rb +2 -2
  82. data/spec/cucumber/broadcaster_spec.rb +1 -1
  83. data/spec/cucumber/cli/configuration_spec.rb +32 -6
  84. data/spec/cucumber/cli/drb_client_spec.rb +2 -3
  85. data/spec/cucumber/cli/main_spec.rb +43 -43
  86. data/spec/cucumber/cli/options_spec.rb +28 -1
  87. data/spec/cucumber/cli/profile_loader_spec.rb +1 -1
  88. data/spec/cucumber/core_ext/proc_spec.rb +1 -1
  89. data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
  90. data/spec/cucumber/formatter/duration_spec.rb +1 -1
  91. data/spec/cucumber/formatter/html_spec.rb +3 -5
  92. data/spec/cucumber/formatter/junit_spec.rb +16 -2
  93. data/spec/cucumber/formatter/progress_spec.rb +1 -1
  94. data/spec/cucumber/formatter/spec_helper.rb +11 -12
  95. data/spec/cucumber/rb_support/rb_language_spec.rb +241 -28
  96. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +33 -28
  97. data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +1 -1
  98. data/spec/cucumber/step_match_spec.rb +11 -9
  99. data/spec/cucumber/wire_support/configuration_spec.rb +1 -1
  100. data/spec/cucumber/wire_support/connection_spec.rb +1 -1
  101. data/spec/cucumber/wire_support/wire_exception_spec.rb +1 -1
  102. data/spec/cucumber/wire_support/wire_language_spec.rb +1 -1
  103. data/spec/cucumber/wire_support/wire_packet_spec.rb +1 -1
  104. data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
  105. data/spec/cucumber/world/pending_spec.rb +2 -2
  106. data/spec/spec_helper.rb +13 -20
  107. metadata +11 -222
  108. data/.gitignore +0 -20
  109. data/Caliper.yml +0 -4
  110. data/History.txt +0 -1552
  111. data/README.rdoc +0 -26
  112. data/VERSION.yml +0 -5
  113. data/examples/i18n/ro/features/suma.feature +0 -11
  114. data/features/announce.feature +0 -164
  115. data/features/around_hooks.feature +0 -232
  116. data/features/bug_371.feature +0 -32
  117. data/features/bug_464.feature +0 -16
  118. data/features/bug_475.feature +0 -42
  119. data/features/bug_585_tab_indentation.feature +0 -22
  120. data/features/bug_600.feature +0 -67
  121. data/features/call_steps_from_stepdefs.feature +0 -154
  122. data/features/cucumber_cli.feature +0 -591
  123. data/features/cucumber_cli_outlines.feature +0 -117
  124. data/features/default_snippets.feature +0 -42
  125. data/features/diffing.feature +0 -25
  126. data/features/drb_server_integration.feature +0 -174
  127. data/features/exception_in_after_block.feature +0 -127
  128. data/features/exception_in_after_step_block.feature +0 -104
  129. data/features/exception_in_before_block.feature +0 -98
  130. data/features/exclude_files.feature +0 -20
  131. data/features/expand.feature +0 -60
  132. data/features/html_formatter.feature +0 -8
  133. data/features/html_formatter/a.html +0 -582
  134. data/features/junit_formatter.feature +0 -88
  135. data/features/language_from_header.feature +0 -30
  136. data/features/language_help.feature +0 -78
  137. data/features/listener_debugger_formatter.feature +0 -42
  138. data/features/multiline_names.feature +0 -44
  139. data/features/negative_tagged_hooks.feature +0 -60
  140. data/features/post_configuration_hook.feature +0 -37
  141. data/features/profiles.feature +0 -126
  142. data/features/rake_task.feature +0 -152
  143. data/features/report_called_undefined_steps.feature +0 -34
  144. data/features/rerun_formatter.feature +0 -45
  145. data/features/simplest.feature +0 -11
  146. data/features/snippet.feature +0 -23
  147. data/features/snippets_when_using_star_keyword.feature +0 -36
  148. data/features/step_definitions/extra_steps.rb +0 -2
  149. data/features/step_definitions/simplest_steps.rb +0 -3
  150. data/features/step_definitions/wire_steps.rb +0 -32
  151. data/features/support/env.rb.simplest +0 -7
  152. data/features/support/fake_wire_server.rb +0 -77
  153. data/features/table_diffing.feature +0 -45
  154. data/features/table_mapping.feature +0 -34
  155. data/features/tag_logic.feature +0 -258
  156. data/features/transform.feature +0 -245
  157. data/features/unicode_table.feature +0 -35
  158. data/features/usage_and_stepdefs_formatter.feature +0 -169
  159. data/features/wire_protocol.feature +0 -332
  160. data/features/wire_protocol_table_diffing.feature +0 -119
  161. data/features/wire_protocol_tags.feature +0 -87
  162. data/features/wire_protocol_timeouts.feature +0 -63
  163. data/features/work_in_progress.feature +0 -156
  164. data/fixtures/json/features/pystring.feature +0 -8
  165. data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +0 -12
  166. data/fixtures/self_test/features/background/background_with_name.feature +0 -7
  167. data/fixtures/self_test/features/background/failing_background.feature +0 -12
  168. data/fixtures/self_test/features/background/failing_background_after_success.feature +0 -11
  169. data/fixtures/self_test/features/background/multiline_args_background.feature +0 -32
  170. data/fixtures/self_test/features/background/passing_background.feature +0 -10
  171. data/fixtures/self_test/features/background/pending_background.feature +0 -10
  172. data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +0 -16
  173. data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +0 -16
  174. data/gem_tasks/features.rake +0 -14
  175. data/gem_tasks/sdoc.rake +0 -12
  176. data/lib/cucumber/ast/py_string.rb +0 -80
  177. data/lib/cucumber/formatter/color_io.rb +0 -23
  178. data/lib/cucumber/formatter/tag_cloud.rb +0 -35
  179. data/spec/cucumber/ast/py_string_spec.rb +0 -40
  180. data/spec/cucumber/formatter/color_io_spec.rb +0 -29
  181. data/spec/cucumber/step_mother_spec.rb +0 -302
@@ -1,35 +0,0 @@
1
- Feature: Unicode in tables
2
- In order to please the whole world,
3
- unicode characters in tables should be
4
- properly aligned
5
-
6
- Scenario: All sorts of weird stuff
7
- Given a standard Cucumber project directory structure
8
- And a file named "features/unicode.feature" with:
9
- """
10
- Feature: Featuring unicode
11
-
12
- Scenario: So what, whatever
13
- Given passing
14
- | Brüno | abc |
15
- | Bruno | æøå |
16
- """
17
- And a file named "features/env.rb" with:
18
- """
19
- $KCODE='u'
20
- """
21
- When I run cucumber -q --dry-run features/unicode.feature
22
- Then it should pass with
23
- """
24
- Feature: Featuring unicode
25
-
26
- Scenario: So what, whatever
27
- Given passing
28
- | Brüno | abc |
29
- | Bruno | æøå |
30
-
31
- 1 scenario (1 undefined)
32
- 1 step (1 undefined)
33
-
34
- """
35
-
@@ -1,169 +0,0 @@
1
- Feature: Cucumber command line
2
- In order to be able to write an editor plugin that can jump between
3
- steps and step definitions, Cucumber must provide a way to
4
- display how they are related.
5
-
6
- Scenario: List usage of step definitions
7
- When I run cucumber features --format usage --dry-run
8
- Then STDERR should be empty
9
- And it should pass with
10
- """
11
- -------------------------------------UU-U--------------UUUUU---------U-------U--------------U-UU-------------------------------------------------UU
12
-
13
- /^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
14
- Given '10' cukes # features/background/background_with_name.feature:4
15
- Given '10' cukes # features/background/background_with_name.feature:4
16
- And '10' cukes # features/background/failing_background.feature:6
17
- And '10' cukes # features/background/failing_background.feature:6
18
- And '10' cukes # features/background/failing_background.feature:6
19
- Given '10' cukes # features/background/passing_background.feature:4
20
- Given '10' cukes # features/background/passing_background.feature:4
21
- Given '10' cukes # features/background/passing_background.feature:4
22
- Given '10' cukes # features/background/scenario_outline_passing_background.feature:4
23
- Given '2' cukes # features/tons_of_cukes.feature:4
24
- Given '2' cukes # features/tons_of_cukes.feature:5
25
- Given '2' cukes # features/tons_of_cukes.feature:6
26
- Given '2' cukes # features/tons_of_cukes.feature:7
27
- Given '2' cukes # features/tons_of_cukes.feature:8
28
- Given '2' cukes # features/tons_of_cukes.feature:9
29
- Given '2' cukes # features/tons_of_cukes.feature:10
30
- Given '2' cukes # features/tons_of_cukes.feature:11
31
- Given '2' cukes # features/tons_of_cukes.feature:12
32
- Given '2' cukes # features/tons_of_cukes.feature:13
33
- Given '2' cukes # features/tons_of_cukes.feature:14
34
- Given '2' cukes # features/tons_of_cukes.feature:15
35
- Given '2' cukes # features/tons_of_cukes.feature:16
36
- Given '2' cukes # features/tons_of_cukes.feature:17
37
- Given '2' cukes # features/tons_of_cukes.feature:18
38
- Given '2' cukes # features/tons_of_cukes.feature:19
39
- Given '2' cukes # features/tons_of_cukes.feature:20
40
- Given '2' cukes # features/tons_of_cukes.feature:21
41
- Given '2' cukes # features/tons_of_cukes.feature:22
42
- Given '2' cukes # features/tons_of_cukes.feature:23
43
- Given '2' cukes # features/tons_of_cukes.feature:24
44
- Given '2' cukes # features/tons_of_cukes.feature:25
45
- Given '2' cukes # features/tons_of_cukes.feature:26
46
- Given '2' cukes # features/tons_of_cukes.feature:27
47
- Given '2' cukes # features/tons_of_cukes.feature:28
48
- Given '2' cukes # features/tons_of_cukes.feature:29
49
- Given '2' cukes # features/tons_of_cukes.feature:30
50
- Given '2' cukes # features/tons_of_cukes.feature:31
51
- Given '2' cukes # features/tons_of_cukes.feature:32
52
- Given '2' cukes # features/tons_of_cukes.feature:33
53
- Given '2' cukes # features/tons_of_cukes.feature:34
54
- Given '2' cukes # features/tons_of_cukes.feature:35
55
- Given '2' cukes # features/tons_of_cukes.feature:36
56
- Given '2' cukes # features/tons_of_cukes.feature:37
57
- Given '2' cukes # features/tons_of_cukes.feature:38
58
- Given '2' cukes # features/tons_of_cukes.feature:39
59
- Given '2' cukes # features/tons_of_cukes.feature:40
60
- Given '2' cukes # features/tons_of_cukes.feature:41
61
- Given '2' cukes # features/tons_of_cukes.feature:42
62
- Given '2' cukes # features/tons_of_cukes.feature:43
63
- Given '2' cukes # features/tons_of_cukes.feature:44
64
- Given '2' cukes # features/tons_of_cukes.feature:45
65
- Given '2' cukes # features/tons_of_cukes.feature:46
66
- Given '2' cukes # features/tons_of_cukes.feature:47
67
- Given '2' cukes # features/tons_of_cukes.feature:48
68
- Given '2' cukes # features/tons_of_cukes.feature:49
69
- Given '2' cukes # features/tons_of_cukes.feature:50
70
- Given '2' cukes # features/tons_of_cukes.feature:51
71
- Given '2' cukes # features/tons_of_cukes.feature:52
72
- /^'(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:35
73
- And '10' global cukes # features/background/failing_background_after_success.feature:5
74
- And '10' global cukes # features/background/failing_background_after_success.feature:5
75
- And '10' global cukes # features/background/failing_background_after_success.feature:5
76
- /^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
77
- Then I should have '10' cukes # features/background/background_with_name.feature:7
78
- Then I should have '10' cukes # features/background/failing_background.feature:9
79
- Then I should have '10' cukes # features/background/failing_background.feature:12
80
- Then I should have '10' cukes # features/background/passing_background.feature:7
81
- Then I should have '10' cukes # features/background/passing_background.feature:10
82
- Then I should have '10' cukes # features/background/pending_background.feature:7
83
- Then I should have '10' cukes # features/background/pending_background.feature:10
84
- /^I should have '(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:42
85
- Then I should have '10' global cukes # features/background/failing_background_after_success.feature:8
86
- Then I should have '10' global cukes # features/background/failing_background_after_success.feature:11
87
- /^a step definition that calls an undefined step$/ # features/step_definitions/sample_steps.rb:19
88
- Given a step definition that calls an undefined step # features/call_undefined_step_from_step_def.feature:4
89
- /^another unused$/ # features/step_definitions/sample_steps.rb:69
90
- NOT MATCHED BY ANY STEPS
91
- /^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
92
- Given call step "a step definition that calls an undefined step" # features/call_undefined_step_from_step_def.feature:7
93
- /^failing expectation$/ # features/step_definitions/sample_steps.rb:62
94
- Given failing expectation # features/failing_expectation.feature:4
95
- /^failing without a table$/ # features/step_definitions/sample_steps.rb:15
96
- Given failing without a table # features/background/failing_background.feature:5
97
- Given failing without a table # features/background/failing_background.feature:5
98
- Given failing without a table # features/background/failing_background.feature:5
99
- Given failing without a table # features/background/scenario_outline_failing_background.feature:4
100
- Given failing without a table # features/search_sample.feature:10
101
- /^failing$/ # features/step_definitions/sample_steps.rb:8
102
- Given failing # features/sample.feature:18
103
- /^multiline string$/ # features/step_definitions/sample_steps.rb:50
104
- And multiline string # features/background/multiline_args_background.feature:7
105
- And multiline string # features/background/multiline_args_background.feature:7
106
- And multiline string # features/background/multiline_args_background.feature:7
107
- /^passing without a table$/ # features/step_definitions/sample_steps.rb:12
108
- Given passing without a table # features/background/background_tagged_before_on_outline.feature:5
109
- Given passing without a table # features/background/failing_background_after_success.feature:4
110
- Given passing without a table # features/background/failing_background_after_success.feature:4
111
- Given passing without a table # features/background/failing_background_after_success.feature:4
112
- Given passing without a table # features/multiline_name.feature:6
113
- Given passing without a table # features/multiline_name.feature:6
114
- Given passing without a table # features/multiline_name.feature:11
115
- Given passing without a table # features/search_sample.feature:4
116
- Given passing without a table # features/search_sample.feature:4
117
- Given passing without a table # features/search_sample.feature:7
118
- Given passing without a table # features/search_sample.feature:4
119
- /^passing$/ # features/step_definitions/sample_steps.rb:5
120
- Given passing # features/sample.feature:12
121
- /^table$/ # features/step_definitions/sample_steps.rb:46
122
- Given table # features/background/multiline_args_background.feature:4
123
- Given table # features/background/multiline_args_background.feature:4
124
- Given table # features/background/multiline_args_background.feature:4
125
- /^the multiline string should be$/ # features/step_definitions/sample_steps.rb:58
126
- Then the multiline string should be # features/background/multiline_args_background.feature:17
127
- Then the multiline string should be # features/background/multiline_args_background.feature:27
128
- /^the table should be$/ # features/step_definitions/sample_steps.rb:54
129
- Then the table should be # features/background/multiline_args_background.feature:14
130
- Then the table should be # features/background/multiline_args_background.feature:24
131
- /^unused$/ # features/step_definitions/sample_steps.rb:66
132
- NOT MATCHED BY ANY STEPS
133
-
134
- 43 scenarios (32 skipped, 10 undefined, 1 passed)
135
- 131 steps (117 skipped, 14 undefined)
136
-
137
- """
138
-
139
- Scenario: --format stepdefs
140
- When I run cucumber features --format stepdefs --dry-run
141
- Then STDERR should be empty
142
- And it should pass with
143
- """
144
- -------------------------------------UU-U--------------UUUUU---------U-------U--------------U-UU-------------------------------------------------UU
145
-
146
- /^'(.+)' cukes$/ # features/step_definitions/sample_steps.rb:27
147
- /^'(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:35
148
- /^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
149
- /^I should have '(.+)' global cukes$/ # features/step_definitions/sample_steps.rb:42
150
- /^a step definition that calls an undefined step$/ # features/step_definitions/sample_steps.rb:19
151
- /^another unused$/ # features/step_definitions/sample_steps.rb:69
152
- NOT MATCHED BY ANY STEPS
153
- /^call step "(.*)"$/ # features/step_definitions/sample_steps.rb:23
154
- /^failing expectation$/ # features/step_definitions/sample_steps.rb:62
155
- /^failing without a table$/ # features/step_definitions/sample_steps.rb:15
156
- /^failing$/ # features/step_definitions/sample_steps.rb:8
157
- /^multiline string$/ # features/step_definitions/sample_steps.rb:50
158
- /^passing without a table$/ # features/step_definitions/sample_steps.rb:12
159
- /^passing$/ # features/step_definitions/sample_steps.rb:5
160
- /^table$/ # features/step_definitions/sample_steps.rb:46
161
- /^the multiline string should be$/ # features/step_definitions/sample_steps.rb:58
162
- /^the table should be$/ # features/step_definitions/sample_steps.rb:54
163
- /^unused$/ # features/step_definitions/sample_steps.rb:66
164
- NOT MATCHED BY ANY STEPS
165
-
166
- 43 scenarios (32 skipped, 10 undefined, 1 passed)
167
- 131 steps (117 skipped, 14 undefined)
168
-
169
- """
@@ -1,332 +0,0 @@
1
- @wire
2
- Feature: Wire Protocol
3
- In order to be allow Cucumber to touch my app in intimate places
4
- As a developer on platform which doesn't support Ruby
5
- I want a low-level protocol which Cucumber can use to run steps within my app
6
-
7
- #
8
- # Cucumber's wire protocol is an implementation of Cucumber's internal
9
- # 'programming language' abstraction, and allows step definitions to be
10
- # implemented and invoked on any platform.
11
- #
12
- # Communication is over a TCP socket, which Cucumber connects to when it finds
13
- # a definition file with the .wire extension in the step_definitions folder
14
- # (or other load path).
15
- #
16
- # Cucumber sends the following request messages out over the wire:
17
- #
18
- # * step_matches : this is used to find out whether the wire server has a
19
- # definition for a given step
20
- # * invoke : this is used to ask for a step definition to be invoked
21
- # * begin_scenario : signals that cucumber is about to execute a scenario
22
- # * end_scenario : signals that cucumber has finished executing a scenario
23
- # * snippet_text : requests a snippet for an undefined step
24
- #
25
- # Every message supports two standard responses:
26
- # * success : which expects different arguments (sometimes none at
27
- # all) depending on the request.
28
- # * fail : causes a Cucumber::WireSupport::WireException to be
29
- # raised.
30
- #
31
- # Some messages support more responses - see below for details.
32
- #
33
- # A WirePacket flowing in either direction is formatted as a JSON-encoded
34
- # string, with a newline character signalling the end of a packet. See the
35
- # specs for Cucumber::WireSupport::WirePacket for more details.
36
- #
37
- # These messages are described in detail below, with examples.
38
- #
39
-
40
- Background:
41
- Given a standard Cucumber project directory structure
42
- And a file named "features/wired.feature" with:
43
- """
44
- Feature: High strung
45
- Scenario: Wired
46
- Given we're all wired
47
-
48
- """
49
- And a file named "features/step_definitions/some_remote_place.wire" with:
50
- """
51
- host: localhost
52
- port: 54321
53
-
54
- """
55
-
56
-
57
- #
58
- # # Request: 'step_matches'
59
- #
60
- # When the features have been parsed, Cucumber will send a step_matches
61
- # message to ask the wire server if it can match a step name. This happens for
62
- # each of the steps in each of the features.
63
- #
64
- # The wire server replies with an array of StepMatch objects.
65
-
66
- Scenario: Dry run finds no step match
67
- Given there is a wire server running on port 54321 which understands the following protocol:
68
- | request | response |
69
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
70
- When I run cucumber --dry-run -f progress
71
- And it should pass with
72
- """
73
- U
74
-
75
- 1 scenario (1 undefined)
76
- 1 step (1 undefined)
77
-
78
- """
79
-
80
- # When each StepMatch is returned, it contains the following data:
81
- # * id - identifier for the step definition to be used later when if it
82
- # needs to be invoked. The identifier can be any string value and
83
- # is simply used for the wire server's own reference.
84
- # * args - any argument values as captured by the wire end's own regular
85
- # expression (or other argument matching) process.
86
- Scenario: Dry run finds a step match
87
- Given there is a wire server running on port 54321 which understands the following protocol:
88
- | request | response |
89
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
90
- When I run cucumber --dry-run -f progress
91
- And it should pass with
92
- """
93
- -
94
-
95
- 1 scenario (1 skipped)
96
- 1 step (1 skipped)
97
-
98
- """
99
-
100
- # Optionally, the StepMatch can also contain a source reference, and a native
101
- # regexp string which will be used by some formatters.
102
- Scenario: Step matches returns details about the remote step definition
103
- Given there is a wire server running on port 54321 which understands the following protocol:
104
- | request | response |
105
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[], "source":"MyApp.MyClass:123", "regexp":"we.*"}]] |
106
- When I run cucumber -f stepdefs --dry-run
107
- Then STDERR should be empty
108
- And it should pass with
109
- """
110
- -
111
-
112
- we.* # MyApp.MyClass:123
113
-
114
- 1 scenario (1 skipped)
115
- 1 step (1 skipped)
116
-
117
- """
118
-
119
-
120
- #
121
- # # Request: 'invoke'
122
- #
123
- # Assuming a StepMatch was returned for a given step name, when it's time to
124
- # invoke that step definition, Cucumber will send an invoke message.
125
- #
126
- # The invoke message contains the ID of the step definition, as returned by
127
- # the wire server in response to the the step_matches call, along with the
128
- # arguments that were parsed from the step name during the same step_matches
129
- # call.
130
- #
131
- # The wire server will normally[1] reply one of the following:
132
- # * success
133
- # * fail
134
- # * pending : optionally takes a message argument
135
- #
136
- # [1] This isn't the whole story: see also wire_protocol_table_diffing.feature
137
- #
138
-
139
- # ## Pending Steps
140
- #
141
- Scenario: Invoke a step definition which is pending
142
- Given there is a wire server running on port 54321 which understands the following protocol:
143
- | request | response |
144
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
145
- | ["begin_scenario"] | ["success"] |
146
- | ["invoke",{"id":"1","args":[]}] | ["pending", "I'll do it later"] |
147
- | ["end_scenario"] | ["success"] |
148
- When I run cucumber -f pretty -q
149
- And it should pass with
150
- """
151
- Feature: High strung
152
-
153
- Scenario: Wired
154
- Given we're all wired
155
- I'll do it later (Cucumber::Pending)
156
- features/wired.feature:3:in `Given we're all wired'
157
-
158
- 1 scenario (1 pending)
159
- 1 step (1 pending)
160
-
161
- """
162
-
163
- # ## Passing Steps
164
- #
165
- Scenario: Invoke a step definition which passes
166
- Given there is a wire server running on port 54321 which understands the following protocol:
167
- | request | response |
168
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
169
- | ["begin_scenario"] | ["success"] |
170
- | ["invoke",{"id":"1","args":[]}] | ["success"] |
171
- | ["end_scenario"] | ["success"] |
172
- When I run cucumber -f progress
173
- And it should pass with
174
- """
175
- .
176
-
177
- 1 scenario (1 passed)
178
- 1 step (1 passed)
179
-
180
- """
181
-
182
- # ## Failing Steps
183
- #
184
- # When an invoked step definition fails, it can return details of the exception
185
- # in the reply to invoke. This causes a Cucumber::WireSupport::WireException to be
186
- # raised.
187
- #
188
- # Valid arguments are:
189
- # * message (mandatory)
190
- # * exception
191
- # * backtrace
192
- #
193
- # See the specs for Cucumber::WireSupport::WireException for more details
194
- #
195
- Scenario: Invoke a step definition which fails
196
- Given there is a wire server running on port 54321 which understands the following protocol:
197
- | request | response |
198
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
199
- | ["begin_scenario"] | ["success"] |
200
- | ["invoke",{"id":"1","args":[]}] | ["fail",{"message":"The wires are down", "exception":"Some.Foreign.ExceptionType"}] |
201
- | ["end_scenario"] | ["success"] |
202
- When I run cucumber -f progress
203
- Then STDERR should be empty
204
- And it should fail with
205
- """
206
- F
207
-
208
- (::) failed steps (::)
209
-
210
- The wires are down (Some.Foreign.ExceptionType from localhost:54321)
211
- features/wired.feature:3:in `Given we're all wired'
212
-
213
- Failing Scenarios:
214
- cucumber features/wired.feature:2 # Scenario: Wired
215
-
216
- 1 scenario (1 failed)
217
- 1 step (1 failed)
218
-
219
- """
220
-
221
- # ## Step Arguments
222
- #
223
- # Imagine we have a step definition like:
224
- #
225
- # Given /we're all (.*)/ do | what_we_are |
226
- # end
227
- #
228
- # When this step definition matches the step name in our feature, the word
229
- # 'wired' will be captured as an argument.
230
- #
231
- # Cucumber expects this StepArgument to be returned in the StepMatch. The keys
232
- # have the following meanings:
233
- # * val : the value of the string captured for that argument from the step
234
- # name passed in step_matches
235
- # * pos : the position within the step name that the argument was matched
236
- # (used for formatter highlighting)
237
- #
238
- Scenario: Invoke a step definition which takes string arguments (and passes)
239
- Given there is a wire server running on port 54321 which understands the following protocol:
240
- | request | response |
241
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[{"val":"wired", "pos":10}]}]] |
242
- | ["begin_scenario"] | ["success"] |
243
- | ["invoke",{"id":"1","args":["wired"]}] | ["success"] |
244
- | ["end_scenario"] | ["success"] |
245
- When I run cucumber -f progress
246
- Then STDERR should be empty
247
- And it should pass with
248
- """
249
- .
250
-
251
- 1 scenario (1 passed)
252
- 1 step (1 passed)
253
-
254
- """
255
-
256
- # ## Multiline Table Arguments
257
- #
258
- # When the step has a multiline table argument, it will be passed with the
259
- # invoke message as a string - a serialized JSON array of array of strings.
260
- # In the following scenario our step definition takes two arguments - one
261
- # captures the "we're" and the other takes the table.
262
- Scenario: Invoke a step definition which takes table arguments (and passes)
263
- Given a file named "features/wired_on_tables.feature" with:
264
- """
265
- Feature: High strung
266
- Scenario: Wired and more
267
- Given we're all:
268
- | wired |
269
- | high |
270
- | happy |
271
- """
272
- And there is a wire server running on port 54321 which understands the following protocol:
273
- | request | response |
274
- | ["step_matches",{"name_to_match":"we're all:"}] | ["success",[{"id":"1", "args":[{"val":"we're", "pos":0}]}]] |
275
- | ["begin_scenario"] | ["success"] |
276
- | ["invoke",{"id":"1","args":["we're",[["wired"],["high"],["happy"]]]}] | ["success"] |
277
- | ["end_scenario"] | ["success"] |
278
- When I run cucumber -f progress features/wired_on_tables.feature
279
- Then STDERR should be empty
280
- And it should pass with
281
- """
282
- .
283
-
284
- 1 scenario (1 passed)
285
- 1 step (1 passed)
286
-
287
- """
288
-
289
-
290
- #
291
- # # Request: 'snippets'
292
- #
293
- Scenario: Wire server returns snippets for a step that didn't match
294
- Given there is a wire server running on port 54321 which understands the following protocol:
295
- | request | response |
296
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
297
- | ["snippet_text",{"step_keyword":"Given ","multiline_arg_class":"","step_name":"we're all wired"}] | ["success","foo()\n bar;\nbaz"] |
298
- | ["begin_scenario"] | ["success"] |
299
- | ["end_scenario"] | ["success"] |
300
- When I run cucumber -f pretty
301
- Then STDERR should be empty
302
- And it should pass with
303
- """
304
- Feature: High strung
305
-
306
- Scenario: Wired # features/wired.feature:2
307
- Given we're all wired # features/wired.feature:3
308
-
309
- 1 scenario (1 undefined)
310
- 1 step (1 undefined)
311
-
312
- You can implement step definitions for undefined steps with these snippets:
313
-
314
- foo()
315
- bar;
316
- baz
317
-
318
-
319
- """
320
-
321
- #
322
- # # Bad Response
323
- #
324
- Scenario: Unexpected response
325
- Given there is a wire server running on port 54321 which understands the following protocol:
326
- | request | response |
327
- | ["begin_scenario"] | ["yikes"] |
328
- When I run cucumber -f progress
329
- Then STDERR should match
330
- """
331
- undefined method `handle_yikes'
332
- """