cucumber 0.8.6 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. data/.rspec +1 -1
  2. data/Caliper.yml +4 -0
  3. data/History.txt +1557 -0
  4. data/LICENSE +1 -1
  5. data/README.rdoc +26 -0
  6. data/Rakefile +51 -5
  7. data/VERSION.yml +5 -0
  8. data/bin/cucumber +1 -7
  9. data/cucumber.gemspec +77 -3
  10. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
  11. data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
  12. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +7 -4
  13. data/examples/i18n/ro/features/suma.feature +11 -0
  14. data/examples/i18n/ru/features/division.feature +2 -2
  15. data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
  16. data/examples/sinatra/features/support/env.rb +5 -2
  17. data/examples/v8/features/fibonacci.feature +1 -1
  18. data/examples/watir/features/step_definitions/search_steps.rb +1 -1
  19. data/features/announce.feature +164 -0
  20. data/features/around_hooks.feature +232 -0
  21. data/features/background.feature +95 -284
  22. data/features/bug_371.feature +32 -0
  23. data/features/bug_464.feature +16 -0
  24. data/features/bug_475.feature +42 -0
  25. data/features/bug_585_tab_indentation.feature +22 -0
  26. data/features/bug_600.feature +67 -0
  27. data/features/call_steps_from_stepdefs.feature +154 -0
  28. data/features/cucumber_cli.feature +591 -0
  29. data/features/cucumber_cli_outlines.feature +117 -0
  30. data/features/custom_formatter.feature +73 -3
  31. data/features/default_snippets.feature +42 -0
  32. data/features/diffing.feature +25 -0
  33. data/features/drb_server_integration.feature +174 -0
  34. data/features/exception_in_after_block.feature +127 -0
  35. data/features/exception_in_after_step_block.feature +104 -0
  36. data/features/exception_in_before_block.feature +98 -0
  37. data/features/exclude_files.feature +20 -0
  38. data/features/expand.feature +60 -0
  39. data/features/html_formatter.feature +8 -0
  40. data/features/html_formatter/a.html +582 -0
  41. data/features/json_formatter.feature +245 -160
  42. data/features/junit_formatter.feature +88 -0
  43. data/features/language_from_header.feature +30 -0
  44. data/features/language_help.feature +78 -0
  45. data/features/listener_debugger_formatter.feature +42 -0
  46. data/features/multiline_names.feature +44 -0
  47. data/features/negative_tagged_hooks.feature +60 -0
  48. data/features/post_configuration_hook.feature +37 -0
  49. data/features/profiles.feature +126 -0
  50. data/features/rake_task.feature +152 -0
  51. data/features/report_called_undefined_steps.feature +34 -0
  52. data/features/rerun_formatter.feature +45 -0
  53. data/features/simplest.feature +11 -0
  54. data/features/snippet.feature +23 -0
  55. data/features/snippets_when_using_star_keyword.feature +36 -0
  56. data/features/step_definitions/cucumber_steps.rb +153 -7
  57. data/features/step_definitions/extra_steps.rb +2 -0
  58. data/features/step_definitions/simplest_steps.rb +3 -0
  59. data/features/step_definitions/wire_steps.rb +32 -0
  60. data/features/support/env.rb +140 -18
  61. data/features/support/env.rb.simplest +7 -0
  62. data/features/support/fake_wire_server.rb +77 -0
  63. data/features/table_diffing.feature +45 -0
  64. data/features/table_mapping.feature +34 -0
  65. data/features/tag_logic.feature +258 -0
  66. data/features/transform.feature +245 -0
  67. data/features/unicode_table.feature +35 -0
  68. data/features/usage_and_stepdefs_formatter.feature +169 -0
  69. data/features/wire_protocol.feature +332 -0
  70. data/features/wire_protocol_table_diffing.feature +119 -0
  71. data/features/wire_protocol_tags.feature +87 -0
  72. data/features/wire_protocol_timeouts.feature +63 -0
  73. data/features/work_in_progress.feature +156 -0
  74. data/fixtures/json/features/pystring.feature +8 -0
  75. data/fixtures/junit/features/pending.feature +1 -3
  76. data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +12 -0
  77. data/fixtures/self_test/features/background/background_with_name.feature +7 -0
  78. data/fixtures/self_test/features/background/failing_background.feature +12 -0
  79. data/fixtures/self_test/features/background/failing_background_after_success.feature +11 -0
  80. data/fixtures/self_test/features/background/multiline_args_background.feature +32 -0
  81. data/fixtures/self_test/features/background/passing_background.feature +10 -0
  82. data/fixtures/self_test/features/background/pending_background.feature +10 -0
  83. data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +16 -0
  84. data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +16 -0
  85. data/fixtures/self_test/features/support/env.rb +0 -8
  86. data/fixtures/tickets/features.html +1 -1
  87. data/gem_tasks/examples.rake +1 -1
  88. data/gem_tasks/features.rake +14 -0
  89. data/gem_tasks/sdoc.rake +12 -0
  90. data/lib/cucumber.rb +0 -12
  91. data/lib/cucumber/ast.rb +1 -1
  92. data/lib/cucumber/ast/background.rb +5 -21
  93. data/lib/cucumber/ast/examples.rb +4 -12
  94. data/lib/cucumber/ast/feature.rb +5 -13
  95. data/lib/cucumber/ast/feature_element.rb +4 -9
  96. data/lib/cucumber/ast/outline_table.rb +4 -4
  97. data/lib/cucumber/ast/py_string.rb +80 -0
  98. data/lib/cucumber/ast/scenario.rb +5 -7
  99. data/lib/cucumber/ast/scenario_outline.rb +15 -23
  100. data/lib/cucumber/ast/step.rb +0 -5
  101. data/lib/cucumber/ast/step_invocation.rb +15 -21
  102. data/lib/cucumber/ast/table.rb +8 -14
  103. data/lib/cucumber/ast/tree_walker.rb +48 -10
  104. data/lib/cucumber/cli/configuration.rb +8 -33
  105. data/lib/cucumber/cli/main.rb +35 -20
  106. data/lib/cucumber/cli/options.rb +7 -8
  107. data/lib/cucumber/cli/profile_loader.rb +0 -2
  108. data/lib/cucumber/core_ext/proc.rb +1 -2
  109. data/lib/cucumber/feature_file.rb +15 -47
  110. data/lib/cucumber/formatter/ansicolor.rb +5 -3
  111. data/lib/cucumber/formatter/color_io.rb +23 -0
  112. data/lib/cucumber/formatter/console.rb +23 -27
  113. data/lib/cucumber/formatter/cucumber.css +17 -34
  114. data/lib/cucumber/formatter/cucumber.sass +182 -173
  115. data/lib/cucumber/formatter/html.rb +11 -46
  116. data/lib/cucumber/formatter/io.rb +4 -2
  117. data/lib/cucumber/formatter/json.rb +152 -15
  118. data/lib/cucumber/formatter/json_pretty.rb +6 -5
  119. data/lib/cucumber/formatter/junit.rb +22 -28
  120. data/lib/cucumber/formatter/pdf.rb +6 -6
  121. data/lib/cucumber/formatter/pretty.rb +5 -5
  122. data/lib/cucumber/formatter/rerun.rb +11 -22
  123. data/lib/cucumber/formatter/tag_cloud.rb +35 -0
  124. data/lib/cucumber/formatter/unicode.rb +20 -41
  125. data/lib/cucumber/js_support/js_dsl.js +4 -4
  126. data/lib/cucumber/js_support/js_language.rb +5 -9
  127. data/lib/cucumber/js_support/js_snippets.rb +2 -2
  128. data/lib/cucumber/language_support.rb +2 -2
  129. data/lib/cucumber/parser/gherkin_builder.rb +30 -35
  130. data/lib/cucumber/platform.rb +8 -8
  131. data/lib/cucumber/py_support/py_language.rb +2 -2
  132. data/lib/cucumber/rake/task.rb +31 -74
  133. data/lib/cucumber/rb_support/rb_dsl.rb +0 -1
  134. data/lib/cucumber/rb_support/rb_language.rb +8 -10
  135. data/lib/cucumber/rb_support/rb_step_definition.rb +0 -8
  136. data/lib/cucumber/rb_support/rb_transform.rb +0 -17
  137. data/lib/cucumber/rb_support/rb_world.rb +18 -26
  138. data/lib/cucumber/rspec/doubles.rb +3 -3
  139. data/lib/cucumber/step_match.rb +2 -6
  140. data/lib/cucumber/step_mother.rb +427 -6
  141. data/lib/cucumber/wire_support/configuration.rb +1 -4
  142. data/lib/cucumber/wire_support/wire_language.rb +10 -3
  143. data/spec/cucumber/ast/background_spec.rb +6 -68
  144. data/spec/cucumber/ast/feature_factory.rb +4 -5
  145. data/spec/cucumber/ast/feature_spec.rb +4 -4
  146. data/spec/cucumber/ast/outline_table_spec.rb +1 -1
  147. data/spec/cucumber/ast/py_string_spec.rb +40 -0
  148. data/spec/cucumber/ast/scenario_outline_spec.rb +11 -15
  149. data/spec/cucumber/ast/scenario_spec.rb +4 -4
  150. data/spec/cucumber/ast/step_spec.rb +3 -3
  151. data/spec/cucumber/ast/table_spec.rb +2 -38
  152. data/spec/cucumber/ast/tree_walker_spec.rb +2 -2
  153. data/spec/cucumber/broadcaster_spec.rb +1 -1
  154. data/spec/cucumber/cli/configuration_spec.rb +6 -32
  155. data/spec/cucumber/cli/drb_client_spec.rb +3 -2
  156. data/spec/cucumber/cli/main_spec.rb +43 -43
  157. data/spec/cucumber/cli/options_spec.rb +1 -28
  158. data/spec/cucumber/cli/profile_loader_spec.rb +1 -1
  159. data/spec/cucumber/core_ext/proc_spec.rb +1 -1
  160. data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
  161. data/spec/cucumber/formatter/color_io_spec.rb +29 -0
  162. data/spec/cucumber/formatter/duration_spec.rb +1 -1
  163. data/spec/cucumber/formatter/html_spec.rb +5 -3
  164. data/spec/cucumber/formatter/junit_spec.rb +2 -16
  165. data/spec/cucumber/formatter/progress_spec.rb +1 -1
  166. data/spec/cucumber/formatter/spec_helper.rb +12 -11
  167. data/spec/cucumber/rb_support/rb_language_spec.rb +28 -241
  168. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +28 -33
  169. data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +1 -1
  170. data/spec/cucumber/step_match_spec.rb +9 -11
  171. data/spec/cucumber/step_mother_spec.rb +302 -0
  172. data/spec/cucumber/wire_support/configuration_spec.rb +1 -1
  173. data/spec/cucumber/wire_support/connection_spec.rb +1 -1
  174. data/spec/cucumber/wire_support/wire_exception_spec.rb +1 -1
  175. data/spec/cucumber/wire_support/wire_language_spec.rb +1 -1
  176. data/spec/cucumber/wire_support/wire_packet_spec.rb +1 -1
  177. data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
  178. data/spec/cucumber/world/pending_spec.rb +2 -2
  179. data/spec/spec_helper.rb +20 -13
  180. metadata +78 -4
@@ -0,0 +1,88 @@
1
+ Feature: JUnit output formatter
2
+ In order for developers to create test reports with ant
3
+ Cucumber should be able to output JUnit xml files
4
+
5
+ Background:
6
+ Given I am in junit
7
+ And the tmp directory is empty
8
+
9
+ Scenario: one feature, one passing scenario, one failing scenario
10
+ When I run cucumber --format junit --out tmp/ features/one_passing_one_failing.feature
11
+ Then it should fail with
12
+ """
13
+
14
+ """
15
+ And "fixtures/junit/tmp/TEST-one_passing_one_failing.xml" with junit duration "0.005" should contain
16
+ """
17
+ <?xml version="1.0" encoding="UTF-8"?>
18
+ <testsuite errors="0" failures="1" name="One passing scenario, one failing scenario" tests="2" time="0.005">
19
+ <testcase classname="One passing scenario, one failing scenario.Passing" name="Passing" time="0.005">
20
+ </testcase>
21
+ <testcase classname="One passing scenario, one failing scenario.Failing" name="Failing" time="0.005">
22
+ <failure message="failed Failing" type="failed">
23
+ Scenario: Failing
24
+
25
+ Given a failing scenario
26
+
27
+ Message:
28
+ (RuntimeError)
29
+ features/one_passing_one_failing.feature:7:in `Given a failing scenario' </failure>
30
+ </testcase>
31
+ </testsuite>
32
+
33
+ """
34
+
35
+ Scenario: pending steps are simply skipped
36
+ When I run cucumber --format junit --out tmp/ features/pending.feature
37
+ Then it should pass with
38
+ """
39
+
40
+ """
41
+ And "fixtures/junit/tmp/TEST-pending.xml" with junit duration "0.009" should contain
42
+ """
43
+ <?xml version="1.0" encoding="UTF-8"?>
44
+ <testsuite errors="0" failures="0" name="Pending step" tests="0" time="0.009">
45
+ </testsuite>
46
+
47
+ """
48
+
49
+ Scenario: pending step with strict option should fail
50
+ When I run cucumber --format junit --out tmp/ features/pending.feature --strict
51
+ Then it should fail with
52
+ """
53
+
54
+ """
55
+ And "fixtures/junit/tmp/TEST-pending.xml" with junit duration "0.000160" should contain
56
+ """
57
+ <?xml version="1.0" encoding="UTF-8"?>
58
+ <testsuite errors="0" failures="1" name="Pending step" tests="1" time="0.000160">
59
+ <testcase classname="Pending step.Pending" name="Pending" time="0.000160">
60
+ <failure message="pending Pending" type="pending">
61
+ Scenario: Pending
62
+
63
+ TODO (Cucumber::Pending)
64
+ features/pending.feature:4:in `Given a pending step' </failure>
65
+ </testcase>
66
+ </testsuite>
67
+
68
+ """
69
+
70
+ Scenario: run all features
71
+ When I run cucumber --format junit --out tmp/ features
72
+ Then it should fail with
73
+ """
74
+
75
+ """
76
+ And "fixtures/junit/tmp/TEST-one_passing_one_failing.xml" should exist
77
+ And "fixtures/junit/tmp/TEST-pending.xml" should exist
78
+
79
+ Scenario: show correct error message if no --out is passed
80
+ When I run cucumber --format junit features
81
+ Then STDERR should not match
82
+ """
83
+ can't convert .* into String \(TypeError\)
84
+ """
85
+ And STDERR should match
86
+ """
87
+ You \*must\* specify \-\-out DIR for the junit formatter
88
+ """
@@ -0,0 +1,30 @@
1
+ Feature: Language from header
2
+ In order to simplify command line and
3
+ settings in IDEs, Cucumber should pick
4
+ up parser language from a header.
5
+
6
+ Scenario: LOLCAT
7
+ Given a standard Cucumber project directory structure
8
+ And a file named "features/lolcat.feature" with:
9
+ """
10
+ # language: en-lol
11
+ OH HAI: STUFFING
12
+ B4: HUNGRY
13
+ MISHUN: CUKES
14
+ DEN KTHXBAI
15
+ """
16
+ When I run cucumber -i features/lolcat.feature
17
+ Then it should pass with
18
+ """
19
+ # language: en-lol
20
+ OH HAI: STUFFING
21
+
22
+ B4: HUNGRY # features/lolcat.feature:3
23
+
24
+ MISHUN: CUKES # features/lolcat.feature:4
25
+ DEN KTHXBAI # features/lolcat.feature:5
26
+
27
+ 1 scenario (1 undefined)
28
+ 1 step (1 undefined)
29
+
30
+ """
@@ -0,0 +1,78 @@
1
+ @needs-many-fonts
2
+ Feature: Language help
3
+ In order to figure out the keywords to use for a language
4
+ I want to be able to get help on the language from the CLI
5
+
6
+ Scenario: Get help for Portuguese language
7
+ When I run cucumber --i18n pt help
8
+ Then it should pass with
9
+ """
10
+ | feature | "Funcionalidade" |
11
+ | background | "Contexto" |
12
+ | scenario | "Cenário", "Cenario" |
13
+ | scenario_outline | "Esquema do Cenário", "Esquema do Cenario" |
14
+ | examples | "Exemplos" |
15
+ | given | "* ", "Dado " |
16
+ | when | "* ", "Quando " |
17
+ | then | "* ", "Então ", "Entao " |
18
+ | and | "* ", "E " |
19
+ | but | "* ", "Mas " |
20
+ | given (code) | "Dado" |
21
+ | when (code) | "Quando" |
22
+ | then (code) | "Então", "Entao" |
23
+ | and (code) | "E" |
24
+ | but (code) | "Mas" |
25
+
26
+ """
27
+ Scenario: List languages
28
+ When I run cucumber --i18n help
29
+ Then STDERR should be empty
30
+ Then it should pass with
31
+ """
32
+ | ar | Arabic | العربية |
33
+ | bg | Bulgarian | български |
34
+ | ca | Catalan | català |
35
+ | cs | Czech | Česky |
36
+ | cy-GB | Welsh | Cymraeg |
37
+ | da | Danish | dansk |
38
+ | de | German | Deutsch |
39
+ | en | English | English |
40
+ | en-Scouse | Scouse | Scouse |
41
+ | en-au | Australian | Australian |
42
+ | en-lol | LOLCAT | LOLCAT |
43
+ | en-pirate | Pirate | Pirate |
44
+ | en-tx | Texan | Texan |
45
+ | eo | Esperanto | Esperanto |
46
+ | es | Spanish | español |
47
+ | et | Estonian | eesti keel |
48
+ | fi | Finnish | suomi |
49
+ | fr | French | français |
50
+ | he | Hebrew | עברית |
51
+ | hr | Croatian | hrvatski |
52
+ | hu | Hungarian | magyar |
53
+ | id | Indonesian | Bahasa Indonesia |
54
+ | it | Italian | italiano |
55
+ | ja | Japanese | 日本語 |
56
+ | ko | Korean | 한국어 |
57
+ | lt | Lithuanian | lietuvių kalba |
58
+ | lu | Luxemburgish | Lëtzebuergesch |
59
+ | lv | Latvian | latviešu |
60
+ | nl | Dutch | Nederlands |
61
+ | no | Norwegian | norsk |
62
+ | pl | Polish | polski |
63
+ | pt | Portuguese | português |
64
+ | ro | Romanian | română |
65
+ | ro-RO | Romanian (diacritical) | română (diacritical) |
66
+ | ru | Russian | русский |
67
+ | sk | Slovak | Slovensky |
68
+ | sr-Cyrl | Serbian | Српски |
69
+ | sr-Latn | Serbian (Latin) | Srpski (Latinica) |
70
+ | sv | Swedish | Svenska |
71
+ | tr | Turkish | Türkçe |
72
+ | uk | Ukrainian | Українська |
73
+ | uz | Uzbek | Узбекча |
74
+ | vi | Vietnamese | Tiếng Việt |
75
+ | zh-CN | Chinese simplified | 简体中文 |
76
+ | zh-TW | Chinese traditional | 繁體中文 |
77
+
78
+ """
@@ -0,0 +1,42 @@
1
+ Feature: Listener Debugger
2
+ In order to easily visualise the listener API
3
+ As a developer
4
+ I want a formatter that prints the calls to the listener as a feature is run
5
+
6
+ Background:
7
+ Given a standard Cucumber project directory structure
8
+
9
+ Scenario: title
10
+ Given a file named "features/sample.feature" with:
11
+ """
12
+ Feature: Sample
13
+
14
+ Scenario: Sample
15
+ Given Sample
16
+
17
+ """
18
+ When I run cucumber -f debug features/sample.feature
19
+ Then STDERR should be empty
20
+ Then it should pass with
21
+ """
22
+ before_features
23
+ before_feature
24
+ before_tags
25
+ after_tags
26
+ feature_name
27
+ before_feature_element
28
+ before_tags
29
+ after_tags
30
+ scenario_name
31
+ before_steps
32
+ before_step
33
+ before_step_result
34
+ step_name
35
+ after_step_result
36
+ after_step
37
+ after_steps
38
+ after_feature_element
39
+ after_feature
40
+ after_features
41
+
42
+ """
@@ -0,0 +1,44 @@
1
+ Feature: Multiline description names
2
+ In order to accurately document feature elements
3
+ As a cucumberist
4
+ I want to have multiline names
5
+
6
+ Scenario: multiline scenario
7
+ When I run cucumber features/multiline_name.feature --no-snippets
8
+ Then STDERR should be empty
9
+ Then it should pass with
10
+ """
11
+ Feature: multiline
12
+
13
+ Background: I'm a multiline name # features/multiline_name.feature:3
14
+ which goes on and on and on for three lines
15
+ yawn
16
+ Given passing without a table # features/step_definitions/sample_steps.rb:12
17
+
18
+ Scenario: I'm a multiline name # features/multiline_name.feature:8
19
+ which goes on and on and on for three lines
20
+ yawn
21
+ Given passing without a table # features/step_definitions/sample_steps.rb:12
22
+
23
+ Scenario Outline: I'm a multiline name # features/multiline_name.feature:13
24
+ which goes on and on and on for three lines
25
+ yawn
26
+ Given <state> without a table # features/step_definitions/sample_steps.rb:12
27
+
28
+ Examples:
29
+ | state |
30
+ | passing |
31
+
32
+ Scenario Outline: name # features/multiline_name.feature:21
33
+ Given <state> without a table # features/step_definitions/sample_steps.rb:12
34
+
35
+ Examples: I'm a multiline name
36
+ which goes on and on and on for three lines
37
+ yawn
38
+ | state |
39
+ | passing |
40
+
41
+ 3 scenarios (3 passed)
42
+ 6 steps (6 passed)
43
+
44
+ """
@@ -0,0 +1,60 @@
1
+ Feature: Tagged hooks
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 /^this step works$/ do; end
8
+ """
9
+ And a file named "features/support/hooks.rb" with:
10
+ """
11
+ Before('~@no-boom') do
12
+ raise 'boom'
13
+ end
14
+ """
15
+ And a file named "features/f.feature" with:
16
+ """
17
+ Feature: With and without hooks
18
+ Scenario: using hook
19
+ Given this step works
20
+
21
+ @no-boom
22
+ Scenario: omitting hook
23
+ Given this step works
24
+ """
25
+
26
+ Scenario: omit tagged hook
27
+ When I run cucumber features/f.feature:2
28
+ Then it should fail with
29
+ """
30
+ Feature: With and without hooks
31
+
32
+ Scenario: using hook # features/f.feature:2
33
+ boom (RuntimeError)
34
+ ./features/support/hooks.rb:2:in `Before'
35
+ Given this step works # features/step_definitions/steps.rb:1
36
+
37
+ Failing Scenarios:
38
+ cucumber features/f.feature:2 # Scenario: using hook
39
+
40
+ 1 scenario (1 failed)
41
+ 1 step (1 skipped)
42
+
43
+ """
44
+
45
+ Scenario: omit tagged hook
46
+ When I run cucumber features/f.feature:6
47
+ Then it should pass with
48
+ """
49
+ Feature: With and without hooks
50
+
51
+ @no-boom
52
+ Scenario: omitting hook # features/f.feature:6
53
+ Given this step works # features/step_definitions/steps.rb:1
54
+
55
+ 1 scenario (1 passed)
56
+ 1 step (1 passed)
57
+
58
+ """
59
+
60
+
@@ -0,0 +1,37 @@
1
+ Feature: Post Configuration Hook [#423]
2
+
3
+ In order to extend Cucumber
4
+ As a developer
5
+ I want to manipulate the Cucumber configuration after it has been created
6
+
7
+ Scenario: configuration modified to use HTML formatter
8
+
9
+ Given a standard Cucumber project directory structure
10
+ And a file named "features/support/env.rb" with:
11
+ """
12
+ AfterConfiguration do |config|
13
+ config.options[:formats] << ['html', config.out_stream]
14
+ end
15
+ """
16
+ When I run cucumber features
17
+ Then STDERR should be empty
18
+ And the output should contain
19
+ """
20
+ html
21
+ """
22
+
23
+ Scenario: feature directories read from configuration
24
+
25
+ Given a standard Cucumber project directory structure
26
+ And a file named "features/support/env.rb" with:
27
+ """
28
+ AfterConfiguration do |config|
29
+ config.out_stream << "AfterConfiguration hook read feature directories: #{config.feature_dirs.join(', ')}"
30
+ end
31
+ """
32
+ When I run cucumber features
33
+ Then STDERR should be empty
34
+ And the output should contain
35
+ """
36
+ AfterConfiguration hook read feature directories: features
37
+ """
@@ -0,0 +1,126 @@
1
+ Feature: Profiles
2
+ In order to save time and prevent carpal tunnel syndrome
3
+ Cucumber users can save and reuse commonly used cucumber flags in a 'cucumber.yml' file.
4
+ These named arguments are called profiles and the yml file should be in the root of your project.
5
+ Any cucumber argument is valid in a profile. To see all the available flags type 'cucumber --help'
6
+ For more information about profiles please see the wiki:
7
+ http://wiki.github.com/aslakhellesoy/cucumber/cucumberyml
8
+
9
+ Background: Basic App
10
+ Given a standard Cucumber project directory structure
11
+ And a file named "features/sample.feature" with:
12
+ """
13
+ Feature: Sample
14
+ Scenario: this is a test
15
+ Given I am just testing stuff
16
+ """
17
+ And a file named "features/support/env.rb"
18
+ And a file named "features/support/super_env.rb"
19
+ And the following profiles are defined:
20
+ """
21
+ default: features/sample.feature --require features/support/env.rb -v
22
+ super: features/sample.feature --require features/support/super_env.rb -v
23
+ """
24
+
25
+ Scenario: Explicitly defining a profile to run
26
+ When I run cucumber features/sample.feature --profile super
27
+ Then the output should contain
28
+ """
29
+ Using the super profile...
30
+ """
31
+ And exactly these files should be loaded: features/support/super_env.rb
32
+
33
+ Scenario: Explicitly defining a profile defined in an ERB formatted file
34
+ Given the following profiles are defined:
35
+ """
36
+ <% requires = "--require features/support/super_env.rb" %>
37
+ super: <%= "features/sample.feature #{requires} -v" %>
38
+ """
39
+ When I run cucumber features/sample.feature --profile super
40
+ Then the output should contain
41
+ """
42
+ Using the super profile...
43
+ """
44
+ And exactly these files should be loaded: features/support/super_env.rb
45
+
46
+ Scenario: Defining multiple profiles to run
47
+ When I run cucumber features/sample.feature --profile default --profile super
48
+ Then the output should contain
49
+ """
50
+ Using the default and super profiles...
51
+ """
52
+ And exactly these files should be loaded: features/support/env.rb, features/support/super_env.rb
53
+
54
+ Scenario: Arguments passed in but no profile specified
55
+ When I run cucumber -v
56
+ Then the default profile should be used
57
+ And exactly these files should be loaded: features/support/env.rb
58
+
59
+ Scenario: Trying to use a missing profile
60
+ When I run cucumber -p foo
61
+ Then STDERR should be
62
+ """
63
+ Could not find profile: 'foo'
64
+
65
+ Defined profiles in cucumber.yml:
66
+ * default
67
+ * super
68
+
69
+ """
70
+
71
+ Scenario Outline: Disabling the default profile
72
+ When I run cucumber -v features/ <Flag>
73
+ Then the output should contain
74
+ """
75
+ Disabling profiles...
76
+ """
77
+ And exactly these files should be loaded: features/support/env.rb, features/support/super_env.rb
78
+
79
+ Examples:
80
+ | Flag |
81
+ | -P |
82
+ | --no-profile |
83
+
84
+
85
+ Scenario: Overriding the profile's features to run
86
+ Given a file named "features/another.feature" with:
87
+ """
88
+ Feature: Just this one should be ran
89
+ """
90
+ When I run cucumber -p default features/another.feature
91
+ Then exactly these features should be ran: features/another.feature
92
+
93
+ Scenario: Overriding the profile's formatter
94
+ You will most likely want to define a formatter in your default formatter.
95
+ However, you often want to run your features with a different formatter
96
+ yet still use the other the other arguments in the profile. Cucumber will
97
+ allow you to do this by giving precedence to the formatter specified on the
98
+ command line and override the one in the profile.
99
+
100
+ Given the following profiles are defined:
101
+ """
102
+ default: features/sample.feature --require features/support/env.rb -v --format profile
103
+ """
104
+ When I run cucumber features --format pretty
105
+ And the output should contain
106
+ """
107
+ Feature: Sample
108
+ """
109
+
110
+ Scenario Outline: Showing profiles when listing failing scenarios
111
+ Given a file named "features/step_definitions/steps.rb" with:
112
+ """
113
+ Given /^I am just testing stuff$/ do
114
+ raise 'BANG'
115
+ end
116
+ """
117
+ When I run cucumber -q -p super -p default -f <format> features/sample.feature --require features/step_definitions/steps.rb
118
+ Then it should fail
119
+ And the output should contain
120
+ """
121
+ cucumber -p super features/sample.feature:2 # Scenario: this is a test
122
+ """
123
+ Examples:
124
+ | format |
125
+ | pretty |
126
+ | progress|