cucumber 0.8.6 → 0.8.7
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.
- data/.rspec +1 -1
- data/Caliper.yml +4 -0
- data/History.txt +1557 -0
- data/LICENSE +1 -1
- data/README.rdoc +26 -0
- data/Rakefile +51 -5
- data/VERSION.yml +5 -0
- data/bin/cucumber +1 -7
- data/cucumber.gemspec +77 -3
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/he/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +7 -4
- data/examples/i18n/ro/features/suma.feature +11 -0
- data/examples/i18n/ru/features/division.feature +2 -2
- data/examples/i18n/tr/features/step_definitons/hesap_makinesi_adimlari.rb +3 -3
- data/examples/sinatra/features/support/env.rb +5 -2
- data/examples/v8/features/fibonacci.feature +1 -1
- data/examples/watir/features/step_definitions/search_steps.rb +1 -1
- data/features/announce.feature +164 -0
- data/features/around_hooks.feature +232 -0
- data/features/background.feature +95 -284
- data/features/bug_371.feature +32 -0
- data/features/bug_464.feature +16 -0
- data/features/bug_475.feature +42 -0
- data/features/bug_585_tab_indentation.feature +22 -0
- data/features/bug_600.feature +67 -0
- data/features/call_steps_from_stepdefs.feature +154 -0
- data/features/cucumber_cli.feature +591 -0
- data/features/cucumber_cli_outlines.feature +117 -0
- data/features/custom_formatter.feature +73 -3
- data/features/default_snippets.feature +42 -0
- data/features/diffing.feature +25 -0
- data/features/drb_server_integration.feature +174 -0
- data/features/exception_in_after_block.feature +127 -0
- data/features/exception_in_after_step_block.feature +104 -0
- data/features/exception_in_before_block.feature +98 -0
- data/features/exclude_files.feature +20 -0
- data/features/expand.feature +60 -0
- data/features/html_formatter.feature +8 -0
- data/features/html_formatter/a.html +582 -0
- data/features/json_formatter.feature +245 -160
- data/features/junit_formatter.feature +88 -0
- data/features/language_from_header.feature +30 -0
- data/features/language_help.feature +78 -0
- data/features/listener_debugger_formatter.feature +42 -0
- data/features/multiline_names.feature +44 -0
- data/features/negative_tagged_hooks.feature +60 -0
- data/features/post_configuration_hook.feature +37 -0
- data/features/profiles.feature +126 -0
- data/features/rake_task.feature +152 -0
- data/features/report_called_undefined_steps.feature +34 -0
- data/features/rerun_formatter.feature +45 -0
- data/features/simplest.feature +11 -0
- data/features/snippet.feature +23 -0
- data/features/snippets_when_using_star_keyword.feature +36 -0
- data/features/step_definitions/cucumber_steps.rb +153 -7
- data/features/step_definitions/extra_steps.rb +2 -0
- data/features/step_definitions/simplest_steps.rb +3 -0
- data/features/step_definitions/wire_steps.rb +32 -0
- data/features/support/env.rb +140 -18
- data/features/support/env.rb.simplest +7 -0
- data/features/support/fake_wire_server.rb +77 -0
- data/features/table_diffing.feature +45 -0
- data/features/table_mapping.feature +34 -0
- data/features/tag_logic.feature +258 -0
- data/features/transform.feature +245 -0
- data/features/unicode_table.feature +35 -0
- data/features/usage_and_stepdefs_formatter.feature +169 -0
- data/features/wire_protocol.feature +332 -0
- data/features/wire_protocol_table_diffing.feature +119 -0
- data/features/wire_protocol_tags.feature +87 -0
- data/features/wire_protocol_timeouts.feature +63 -0
- data/features/work_in_progress.feature +156 -0
- data/fixtures/json/features/pystring.feature +8 -0
- data/fixtures/junit/features/pending.feature +1 -3
- data/fixtures/self_test/features/background/background_tagged_before_on_outline.feature +12 -0
- data/fixtures/self_test/features/background/background_with_name.feature +7 -0
- data/fixtures/self_test/features/background/failing_background.feature +12 -0
- data/fixtures/self_test/features/background/failing_background_after_success.feature +11 -0
- data/fixtures/self_test/features/background/multiline_args_background.feature +32 -0
- data/fixtures/self_test/features/background/passing_background.feature +10 -0
- data/fixtures/self_test/features/background/pending_background.feature +10 -0
- data/fixtures/self_test/features/background/scenario_outline_failing_background.feature +16 -0
- data/fixtures/self_test/features/background/scenario_outline_passing_background.feature +16 -0
- data/fixtures/self_test/features/support/env.rb +0 -8
- data/fixtures/tickets/features.html +1 -1
- data/gem_tasks/examples.rake +1 -1
- data/gem_tasks/features.rake +14 -0
- data/gem_tasks/sdoc.rake +12 -0
- data/lib/cucumber.rb +0 -12
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +5 -21
- data/lib/cucumber/ast/examples.rb +4 -12
- data/lib/cucumber/ast/feature.rb +5 -13
- data/lib/cucumber/ast/feature_element.rb +4 -9
- data/lib/cucumber/ast/outline_table.rb +4 -4
- data/lib/cucumber/ast/py_string.rb +80 -0
- data/lib/cucumber/ast/scenario.rb +5 -7
- data/lib/cucumber/ast/scenario_outline.rb +15 -23
- data/lib/cucumber/ast/step.rb +0 -5
- data/lib/cucumber/ast/step_invocation.rb +15 -21
- data/lib/cucumber/ast/table.rb +8 -14
- data/lib/cucumber/ast/tree_walker.rb +48 -10
- data/lib/cucumber/cli/configuration.rb +8 -33
- data/lib/cucumber/cli/main.rb +35 -20
- data/lib/cucumber/cli/options.rb +7 -8
- data/lib/cucumber/cli/profile_loader.rb +0 -2
- data/lib/cucumber/core_ext/proc.rb +1 -2
- data/lib/cucumber/feature_file.rb +15 -47
- data/lib/cucumber/formatter/ansicolor.rb +5 -3
- data/lib/cucumber/formatter/color_io.rb +23 -0
- data/lib/cucumber/formatter/console.rb +23 -27
- data/lib/cucumber/formatter/cucumber.css +17 -34
- data/lib/cucumber/formatter/cucumber.sass +182 -173
- data/lib/cucumber/formatter/html.rb +11 -46
- data/lib/cucumber/formatter/io.rb +4 -2
- data/lib/cucumber/formatter/json.rb +152 -15
- data/lib/cucumber/formatter/json_pretty.rb +6 -5
- data/lib/cucumber/formatter/junit.rb +22 -28
- data/lib/cucumber/formatter/pdf.rb +6 -6
- data/lib/cucumber/formatter/pretty.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +11 -22
- data/lib/cucumber/formatter/tag_cloud.rb +35 -0
- data/lib/cucumber/formatter/unicode.rb +20 -41
- data/lib/cucumber/js_support/js_dsl.js +4 -4
- data/lib/cucumber/js_support/js_language.rb +5 -9
- data/lib/cucumber/js_support/js_snippets.rb +2 -2
- data/lib/cucumber/language_support.rb +2 -2
- data/lib/cucumber/parser/gherkin_builder.rb +30 -35
- data/lib/cucumber/platform.rb +8 -8
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +31 -74
- data/lib/cucumber/rb_support/rb_dsl.rb +0 -1
- data/lib/cucumber/rb_support/rb_language.rb +8 -10
- data/lib/cucumber/rb_support/rb_step_definition.rb +0 -8
- data/lib/cucumber/rb_support/rb_transform.rb +0 -17
- data/lib/cucumber/rb_support/rb_world.rb +18 -26
- data/lib/cucumber/rspec/doubles.rb +3 -3
- data/lib/cucumber/step_match.rb +2 -6
- data/lib/cucumber/step_mother.rb +427 -6
- data/lib/cucumber/wire_support/configuration.rb +1 -4
- data/lib/cucumber/wire_support/wire_language.rb +10 -3
- data/spec/cucumber/ast/background_spec.rb +6 -68
- data/spec/cucumber/ast/feature_factory.rb +4 -5
- data/spec/cucumber/ast/feature_spec.rb +4 -4
- data/spec/cucumber/ast/outline_table_spec.rb +1 -1
- data/spec/cucumber/ast/py_string_spec.rb +40 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +11 -15
- data/spec/cucumber/ast/scenario_spec.rb +4 -4
- data/spec/cucumber/ast/step_spec.rb +3 -3
- data/spec/cucumber/ast/table_spec.rb +2 -38
- data/spec/cucumber/ast/tree_walker_spec.rb +2 -2
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +6 -32
- data/spec/cucumber/cli/drb_client_spec.rb +3 -2
- data/spec/cucumber/cli/main_spec.rb +43 -43
- data/spec/cucumber/cli/options_spec.rb +1 -28
- data/spec/cucumber/cli/profile_loader_spec.rb +1 -1
- data/spec/cucumber/core_ext/proc_spec.rb +1 -1
- data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
- data/spec/cucumber/formatter/color_io_spec.rb +29 -0
- data/spec/cucumber/formatter/duration_spec.rb +1 -1
- data/spec/cucumber/formatter/html_spec.rb +5 -3
- data/spec/cucumber/formatter/junit_spec.rb +2 -16
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +12 -11
- data/spec/cucumber/rb_support/rb_language_spec.rb +28 -241
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +28 -33
- data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +1 -1
- data/spec/cucumber/step_match_spec.rb +9 -11
- data/spec/cucumber/step_mother_spec.rb +302 -0
- data/spec/cucumber/wire_support/configuration_spec.rb +1 -1
- data/spec/cucumber/wire_support/connection_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_exception_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_language_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_packet_spec.rb +1 -1
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/cucumber/world/pending_spec.rb +2 -2
- data/spec/spec_helper.rb +20 -13
- metadata +78 -4
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Feature: Cucumber command line
|
|
2
|
+
In order to write better software
|
|
3
|
+
Developers should be able to execute requirements as tests
|
|
4
|
+
|
|
5
|
+
Scenario: Run scenario outline with filtering on outline name
|
|
6
|
+
When I run cucumber -q features --name "Test state"
|
|
7
|
+
Then it should fail with
|
|
8
|
+
"""
|
|
9
|
+
Feature: Outline Sample
|
|
10
|
+
|
|
11
|
+
Scenario Outline: Test state
|
|
12
|
+
Given <state> without a table
|
|
13
|
+
Given <other_state> without a table
|
|
14
|
+
|
|
15
|
+
Examples: Rainbow colours
|
|
16
|
+
| state | other_state |
|
|
17
|
+
| missing | passing |
|
|
18
|
+
| passing | passing |
|
|
19
|
+
| failing | passing |
|
|
20
|
+
FAIL (RuntimeError)
|
|
21
|
+
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
|
22
|
+
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
|
23
|
+
features/outline_sample.feature:6:in `Given <state> without a table'
|
|
24
|
+
|
|
25
|
+
Examples: Only passing
|
|
26
|
+
| state | other_state |
|
|
27
|
+
| passing | passing |
|
|
28
|
+
|
|
29
|
+
Failing Scenarios:
|
|
30
|
+
cucumber features/outline_sample.feature:5 # Scenario: Test state
|
|
31
|
+
|
|
32
|
+
4 scenarios (1 failed, 1 undefined, 2 passed)
|
|
33
|
+
8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
|
|
34
|
+
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
Scenario: Run scenario outline steps only
|
|
38
|
+
When I run cucumber -q features/outline_sample.feature:7
|
|
39
|
+
Then it should fail with
|
|
40
|
+
"""
|
|
41
|
+
Feature: Outline Sample
|
|
42
|
+
|
|
43
|
+
Scenario Outline: Test state
|
|
44
|
+
Given <state> without a table
|
|
45
|
+
Given <other_state> without a table
|
|
46
|
+
|
|
47
|
+
Examples: Rainbow colours
|
|
48
|
+
| state | other_state |
|
|
49
|
+
| missing | passing |
|
|
50
|
+
| passing | passing |
|
|
51
|
+
| failing | passing |
|
|
52
|
+
FAIL (RuntimeError)
|
|
53
|
+
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
|
54
|
+
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
|
55
|
+
features/outline_sample.feature:6:in `Given <state> without a table'
|
|
56
|
+
|
|
57
|
+
Examples: Only passing
|
|
58
|
+
| state | other_state |
|
|
59
|
+
| passing | passing |
|
|
60
|
+
|
|
61
|
+
Failing Scenarios:
|
|
62
|
+
cucumber features/outline_sample.feature:5 # Scenario: Test state
|
|
63
|
+
|
|
64
|
+
4 scenarios (1 failed, 1 undefined, 2 passed)
|
|
65
|
+
8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
Scenario: Run single failing scenario outline table row
|
|
70
|
+
When I run cucumber features/outline_sample.feature:12
|
|
71
|
+
Then it should fail with
|
|
72
|
+
"""
|
|
73
|
+
Feature: Outline Sample
|
|
74
|
+
|
|
75
|
+
Scenario Outline: Test state # features/outline_sample.feature:5
|
|
76
|
+
Given <state> without a table # features/step_definitions/sample_steps.rb:15
|
|
77
|
+
Given <other_state> without a table # features/step_definitions/sample_steps.rb:12
|
|
78
|
+
|
|
79
|
+
Examples: Rainbow colours
|
|
80
|
+
| state | other_state |
|
|
81
|
+
| failing | passing |
|
|
82
|
+
FAIL (RuntimeError)
|
|
83
|
+
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
|
84
|
+
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
|
85
|
+
features/outline_sample.feature:6:in `Given <state> without a table'
|
|
86
|
+
|
|
87
|
+
Failing Scenarios:
|
|
88
|
+
cucumber features/outline_sample.feature:5 # Scenario: Test state
|
|
89
|
+
|
|
90
|
+
1 scenario (1 failed)
|
|
91
|
+
2 steps (1 failed, 1 skipped)
|
|
92
|
+
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
# There are 10 characters in the progress, but only 8 reported steps. Needs investigation.
|
|
96
|
+
# Looks like we're outputting too many characters.
|
|
97
|
+
Scenario: Run all with progress formatter
|
|
98
|
+
When I run cucumber -q --format progress features/outline_sample.feature
|
|
99
|
+
Then it should fail with
|
|
100
|
+
"""
|
|
101
|
+
--U-..F-..
|
|
102
|
+
|
|
103
|
+
(::) failed steps (::)
|
|
104
|
+
|
|
105
|
+
FAIL (RuntimeError)
|
|
106
|
+
./features/step_definitions/sample_steps.rb:2:in `flunker'
|
|
107
|
+
./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
|
|
108
|
+
features/outline_sample.feature:6:in `Given <state> without a table'
|
|
109
|
+
|
|
110
|
+
Failing Scenarios:
|
|
111
|
+
cucumber features/outline_sample.feature:5 # Scenario: Test state
|
|
112
|
+
|
|
113
|
+
5 scenarios (1 failed, 1 undefined, 3 passed)
|
|
114
|
+
8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
|
|
115
|
+
|
|
116
|
+
"""
|
|
117
|
+
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
Feature: Custom Formatter
|
|
2
2
|
|
|
3
|
+
Scenario: count tags
|
|
4
|
+
When I run cucumber --format Cucumber::Formatter::TagCloud features
|
|
5
|
+
Then STDERR should be empty
|
|
6
|
+
Then it should fail with
|
|
7
|
+
"""
|
|
8
|
+
| @after_file | @background_tagged_before_on_outline | @four | @lots | @one | @sample_four | @sample_one | @sample_three | @sample_two | @three | @two |
|
|
9
|
+
| 1 | 1 | 1 | 1 | 1 | 2 | 1 | 2 | 1 | 2 | 1 |
|
|
10
|
+
|
|
11
|
+
"""
|
|
12
|
+
|
|
3
13
|
Scenario: my own formatter
|
|
4
|
-
Given a
|
|
14
|
+
Given a standard Cucumber project directory structure
|
|
15
|
+
And a file named "features/f.feature" with:
|
|
5
16
|
"""
|
|
6
17
|
Feature: I'll use my own
|
|
7
18
|
because I'm worth it
|
|
@@ -32,10 +43,69 @@ Feature: Custom Formatter
|
|
|
32
43
|
end
|
|
33
44
|
end
|
|
34
45
|
"""
|
|
35
|
-
When I run cucumber
|
|
36
|
-
Then
|
|
46
|
+
When I run cucumber features/f.feature --format Ze::Formator
|
|
47
|
+
Then STDERR should be empty
|
|
48
|
+
Then it should pass with
|
|
37
49
|
"""
|
|
38
50
|
I'LL USE MY OWN
|
|
39
51
|
JUST PRINT ME
|
|
40
52
|
|
|
41
53
|
"""
|
|
54
|
+
|
|
55
|
+
Scenario: Legacy pre-0.7.0 formatter
|
|
56
|
+
Given a standard Cucumber project directory structure
|
|
57
|
+
And a file named "features/f.feature" with:
|
|
58
|
+
"""
|
|
59
|
+
Feature: We like old cukes
|
|
60
|
+
Scenario Outline: just print me
|
|
61
|
+
Given this step works
|
|
62
|
+
|
|
63
|
+
Examples: print me too
|
|
64
|
+
|foo|
|
|
65
|
+
|bar|
|
|
66
|
+
"""
|
|
67
|
+
And a file named "features/step_definitions/steps.rb" with:
|
|
68
|
+
"""
|
|
69
|
+
Given /^this step works$/ do
|
|
70
|
+
end
|
|
71
|
+
"""
|
|
72
|
+
And a file named "features/support/legacy/formator.rb" with:
|
|
73
|
+
"""
|
|
74
|
+
module Legacy
|
|
75
|
+
class Formator
|
|
76
|
+
def initialize(step_mother, io, options)
|
|
77
|
+
@io = io
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def feature_name(name)
|
|
81
|
+
@io.puts name
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def scenario_name(keyword, name, file_colon_line, source_indent)
|
|
85
|
+
@io.puts "#{keyword} #{name}"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def examples_name(keyword, name)
|
|
89
|
+
@io.puts "#{keyword} #{name}"
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
"""
|
|
94
|
+
When I run cucumber features/f.feature --format Legacy::Formator
|
|
95
|
+
Then STDERR should be
|
|
96
|
+
"""
|
|
97
|
+
Legacy::Formator is using a deprecated formatter API. Starting with Cucumber 0.7.0 the signatures
|
|
98
|
+
that have changed are:
|
|
99
|
+
feature_name(keyword, name) # Two arguments. The keyword argument will not contain a colon.
|
|
100
|
+
scenario_name(keyword, name, file_colon_line, source_indent) # The keyword argument will not contain a colon.
|
|
101
|
+
examples_name(keyword, name) # The keyword argument will not contain a colon.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
"""
|
|
105
|
+
Then it should pass with
|
|
106
|
+
"""
|
|
107
|
+
Feature: We like old cukes
|
|
108
|
+
Scenario Outline: just print me
|
|
109
|
+
Examples: print me too
|
|
110
|
+
|
|
111
|
+
"""
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Feature: Print snippets
|
|
2
|
+
In order to make it easier to implement step definitions
|
|
3
|
+
Developers should get a scaffolding for undefined step definitions
|
|
4
|
+
|
|
5
|
+
Scenario: Cucumber doesn't know what language, and defaults to Ruby
|
|
6
|
+
Given a standard Cucumber project directory structure
|
|
7
|
+
And a file named "features/x.feature" with:
|
|
8
|
+
"""
|
|
9
|
+
Feature: X
|
|
10
|
+
Scenario: Y
|
|
11
|
+
Given Z
|
|
12
|
+
Given Q
|
|
13
|
+
"""
|
|
14
|
+
When I run cucumber features
|
|
15
|
+
Then STDERR should be empty
|
|
16
|
+
And it should pass with
|
|
17
|
+
"""
|
|
18
|
+
Feature: X
|
|
19
|
+
|
|
20
|
+
Scenario: Y # features/x.feature:2
|
|
21
|
+
Given Z # features/x.feature:3
|
|
22
|
+
Given Q # features/x.feature:4
|
|
23
|
+
|
|
24
|
+
1 scenario (1 undefined)
|
|
25
|
+
2 steps (2 undefined)
|
|
26
|
+
|
|
27
|
+
You can implement step definitions for undefined steps with these snippets:
|
|
28
|
+
|
|
29
|
+
Given /^Z$/ do
|
|
30
|
+
pending # express the regexp above with the code you wish you had
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Given /^Q$/ do
|
|
34
|
+
pending # express the regexp above with the code you wish you had
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
If you want snippets in a different programming language, just make sure a file
|
|
38
|
+
with the appropriate file extension exists where cucumber looks for step definitions.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Feature: Cucumber command line
|
|
2
|
+
In order to write better software
|
|
3
|
+
Developers should be able to execute requirements as tests
|
|
4
|
+
|
|
5
|
+
@rspec2
|
|
6
|
+
Scenario: Run single failing scenario with default diff enabled
|
|
7
|
+
When I run cucumber -q features/failing_expectation.feature
|
|
8
|
+
Then it should fail with
|
|
9
|
+
"""
|
|
10
|
+
Feature: Failing expectation
|
|
11
|
+
|
|
12
|
+
Scenario: Failing expectation
|
|
13
|
+
Given failing expectation
|
|
14
|
+
expected: "that",
|
|
15
|
+
got: "this" (using ==) (RSpec::Expectations::ExpectationNotMetError)
|
|
16
|
+
./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
|
|
17
|
+
features/failing_expectation.feature:4:in `Given failing expectation'
|
|
18
|
+
|
|
19
|
+
Failing Scenarios:
|
|
20
|
+
cucumber features/failing_expectation.feature:3 # Scenario: Failing expectation
|
|
21
|
+
|
|
22
|
+
1 scenario (1 failed)
|
|
23
|
+
1 step (1 failed)
|
|
24
|
+
|
|
25
|
+
"""
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
@spork
|
|
2
|
+
Feature: DRb Server Integration
|
|
3
|
+
To prevent waiting for Rails and other large Ruby applications to load their environments
|
|
4
|
+
for each feature run Cucumber ships with a DRb client that can speak to a server which
|
|
5
|
+
loads up the environment only once.
|
|
6
|
+
|
|
7
|
+
Background: App with Spork support
|
|
8
|
+
Spork is a gem that has a DRb server and the scenarios below illustrate how to use it.
|
|
9
|
+
However, any DRb server that adheres to the protocol that the client expects would work.
|
|
10
|
+
|
|
11
|
+
Given a standard Cucumber project directory structure
|
|
12
|
+
And a file named "features/support/env.rb" with:
|
|
13
|
+
"""
|
|
14
|
+
require 'rubygems'
|
|
15
|
+
require 'spork'
|
|
16
|
+
|
|
17
|
+
Spork.prefork do
|
|
18
|
+
puts "I'm loading all the heavy stuff..."
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Spork.each_run do
|
|
22
|
+
puts "I'm loading the stuff just for this run..."
|
|
23
|
+
end
|
|
24
|
+
"""
|
|
25
|
+
And a file named "features/sample.feature" with:
|
|
26
|
+
"""
|
|
27
|
+
# language: en
|
|
28
|
+
Feature: Sample
|
|
29
|
+
Scenario: this is a test
|
|
30
|
+
Given I am just testing stuff
|
|
31
|
+
"""
|
|
32
|
+
And a file named "features/essai.feature" with:
|
|
33
|
+
"""
|
|
34
|
+
# language: fr
|
|
35
|
+
Fonctionnalité: Essai
|
|
36
|
+
Scenario: ceci est un test
|
|
37
|
+
Soit je teste
|
|
38
|
+
"""
|
|
39
|
+
And a file named "features/step_definitions/all_your_steps_are_belong_to_us.rb" with:
|
|
40
|
+
"""
|
|
41
|
+
Given /^I am just testing stuff$/ do
|
|
42
|
+
# no-op
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
Soit /^je teste$/ do
|
|
46
|
+
# no-op
|
|
47
|
+
end
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
Scenario: Feature Passing with --drb flag
|
|
51
|
+
Given I am running spork in the background
|
|
52
|
+
|
|
53
|
+
When I run cucumber features --drb
|
|
54
|
+
Then it should pass
|
|
55
|
+
And STDERR should be empty
|
|
56
|
+
And the output should contain
|
|
57
|
+
"""
|
|
58
|
+
1 step (1 passed)
|
|
59
|
+
"""
|
|
60
|
+
And the output should contain
|
|
61
|
+
"""
|
|
62
|
+
I'm loading the stuff just for this run...
|
|
63
|
+
"""
|
|
64
|
+
And the output should not contain
|
|
65
|
+
"""
|
|
66
|
+
I'm loading all the heavy stuff...
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
Scenario: Feature Failing with --drb flag
|
|
70
|
+
Given a file named "features/step_definitions/all_your_steps_are_belong_to_us.rb" with:
|
|
71
|
+
"""
|
|
72
|
+
Given /^I am just testing stuff$/ do
|
|
73
|
+
raise "Oh noes!"
|
|
74
|
+
end
|
|
75
|
+
"""
|
|
76
|
+
And I am running spork in the background
|
|
77
|
+
|
|
78
|
+
When I run cucumber features --drb
|
|
79
|
+
Then it should fail
|
|
80
|
+
And the output should contain
|
|
81
|
+
"""
|
|
82
|
+
1 step (1 failed)
|
|
83
|
+
"""
|
|
84
|
+
And the output should contain
|
|
85
|
+
"""
|
|
86
|
+
I'm loading the stuff just for this run...
|
|
87
|
+
"""
|
|
88
|
+
And the output should not contain
|
|
89
|
+
"""
|
|
90
|
+
I'm loading all the heavy stuff...
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
Scenario: Feature Run with --drb flag with no DRb server running
|
|
94
|
+
Cucumber will fall back on running the features locally in this case.
|
|
95
|
+
|
|
96
|
+
Given I am not running a DRb server in the background
|
|
97
|
+
|
|
98
|
+
When I run cucumber features --drb
|
|
99
|
+
Then it should pass
|
|
100
|
+
And STDERR should match
|
|
101
|
+
"""
|
|
102
|
+
No DRb server is running. Running features locally:
|
|
103
|
+
"""
|
|
104
|
+
And the output should contain
|
|
105
|
+
"""
|
|
106
|
+
I'm loading all the heavy stuff...
|
|
107
|
+
I'm loading the stuff just for this run...
|
|
108
|
+
"""
|
|
109
|
+
And the output should contain
|
|
110
|
+
"""
|
|
111
|
+
1 step (1 passed)
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
Scenario: Feature Run with --drb flag *defined in a profile* with no DRb server running
|
|
116
|
+
|
|
117
|
+
Given I am not running a DRb server in the background
|
|
118
|
+
And the following profile is defined:
|
|
119
|
+
"""
|
|
120
|
+
server: --drb features
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
When I run cucumber --profile server
|
|
124
|
+
Then it should pass
|
|
125
|
+
And STDERR should match
|
|
126
|
+
"""
|
|
127
|
+
No DRb server is running. Running features locally:
|
|
128
|
+
"""
|
|
129
|
+
And the output should contain
|
|
130
|
+
"""
|
|
131
|
+
I'm loading all the heavy stuff...
|
|
132
|
+
I'm loading the stuff just for this run...
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
Scenario: Feature Run with --drb specifying a non-standard port
|
|
136
|
+
|
|
137
|
+
Given I am running spork in the background on port 9000
|
|
138
|
+
|
|
139
|
+
When I run cucumber features --drb --port 9000
|
|
140
|
+
Then it should pass
|
|
141
|
+
And STDERR should be empty
|
|
142
|
+
And the output should contain
|
|
143
|
+
"""
|
|
144
|
+
1 step (1 passed)
|
|
145
|
+
"""
|
|
146
|
+
And the output should contain
|
|
147
|
+
"""
|
|
148
|
+
I'm loading the stuff just for this run...
|
|
149
|
+
"""
|
|
150
|
+
And the output should not contain
|
|
151
|
+
"""
|
|
152
|
+
I'm loading all the heavy stuff...
|
|
153
|
+
"""
|
|
154
|
+
|
|
155
|
+
Scenario: Feature Run with $CUCUMBER_DRB environment variable
|
|
156
|
+
|
|
157
|
+
Given I have environment variable CUCUMBER_DRB set to "9000"
|
|
158
|
+
And I am running spork in the background on port 9000
|
|
159
|
+
|
|
160
|
+
When I run cucumber features/ --drb
|
|
161
|
+
Then it should pass
|
|
162
|
+
And STDERR should be empty
|
|
163
|
+
And the output should contain
|
|
164
|
+
"""
|
|
165
|
+
1 step (1 passed)
|
|
166
|
+
"""
|
|
167
|
+
And the output should contain
|
|
168
|
+
"""
|
|
169
|
+
I'm loading the stuff just for this run...
|
|
170
|
+
"""
|
|
171
|
+
And the output should not contain
|
|
172
|
+
"""
|
|
173
|
+
I'm loading all the heavy stuff...
|
|
174
|
+
"""
|