cucumber 0.4.5.rc2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/.gitignore +1 -0
  2. data/History.txt +11 -2
  3. data/Rakefile +12 -11
  4. data/VERSION.yml +2 -3
  5. data/cucumber.gemspec +39 -31
  6. data/cucumber.yml +1 -1
  7. data/features/language_help.feature +2 -2
  8. data/features/wire_protocol.feature +167 -48
  9. data/features/wire_protocol_table_diffing.feature +95 -0
  10. data/lib/cucumber/cli/configuration.rb +7 -1
  11. data/lib/cucumber/cli/main.rb +6 -2
  12. data/lib/cucumber/cli/options.rb +9 -9
  13. data/lib/cucumber/feature_file.rb +1 -1
  14. data/lib/cucumber/formatter/color_io.rb +4 -4
  15. data/lib/cucumber/formatter/html.rb +4 -3
  16. data/lib/cucumber/formatter/tag_cloud.rb +1 -0
  17. data/lib/cucumber/formatter/unicode.rb +28 -23
  18. data/lib/cucumber/languages.yml +1 -1
  19. data/lib/cucumber/step_argument.rb +3 -3
  20. data/lib/cucumber/step_match.rb +2 -2
  21. data/lib/cucumber/wire_support/connection.rb +4 -0
  22. data/lib/cucumber/wire_support/request_handler.rb +1 -1
  23. data/lib/cucumber/wire_support/wire_exception.rb +23 -1
  24. data/lib/cucumber/wire_support/wire_language.rb +4 -1
  25. data/lib/cucumber/wire_support/wire_packet.rb +0 -4
  26. data/lib/cucumber/wire_support/wire_protocol.rb +51 -7
  27. data/lib/cucumber/wire_support/wire_step_definition.rb +14 -9
  28. data/spec/cucumber/cli/options_spec.rb +4 -8
  29. data/spec/cucumber/formatter/color_io_spec.rb +7 -5
  30. data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +2 -2
  31. data/spec/cucumber/step_match_spec.rb +6 -1
  32. data/spec/cucumber/wire_support/wire_exception_spec.rb +44 -0
  33. data/spec/cucumber/wire_support/wire_step_definition_spec.rb +20 -0
  34. metadata +30 -15
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ examples/self_test/tmp
16
16
  .#*
17
17
  .idea
18
18
  rerun.txt
19
+ ._*
@@ -1,24 +1,33 @@
1
- == In Git
1
+ == 0.5.0 2009-12-15
2
+
3
+ We're bumping to 0.5.0 for this release since all of the Rails code has now moved to a new gem - cucumber-rails.
4
+ Please see History.txt in cucumber-rails for details about what's new on the Rails side.
2
5
 
3
6
  === New features
7
+ * "Given" in Dutch is now aliased to "Gegeven" or "Stel". (Iain Hecker)
8
+ * New --i18n option to list keywords in various languages. (Aslak Hellesøy)
4
9
  * Added a Tcl example using Sam Stephenson's ruby-tcl (Aslak Hellesøy)
5
10
  * Added * as a synonym for Given/When/Then/And/But (for all i18n languages). (#462 Aslak Hellesøy)
6
11
  * The HTML formatter produces a much nicer report, with TextMate link integration. (Rob Aldred)
12
+ * Wire protocol now supports table arguments, step definition source & regexp, snippets, pending, table diffing (Matt Wynne)
7
13
 
8
14
  === Changed Features
9
15
  * Per-word trailing-space setting for step keywords using '<'. See 'fr' in languages.yml for example. (#525 Gregory Hnatiuk)
10
- * --language is deprecated and will be removed in 0.5.0: http://wiki.github.com/aslakhellesoy/cucumber/spoken-languages (Aslak Hellesøy)
11
16
  * Formatters will no longer be passed File objects. They must use ensure_io, ensure_file or ensure_dir. (Aslak Hellesøy)
12
17
 
13
18
  === Bugfixes
19
+ * Exception messages are properly escaped in the HTML report. (Aslak Hellesøy)
20
+ * Improved UTF-8 support for Windows. (Aslak Hellesøy)
14
21
  * Make #element_at / #table_at work on Webrat 0.6.0. This is now deprecated it in favour of #tableish from the cucumber-rails gem. (Aslak Hellesøy)
15
22
  * JUnit formatter not handling multiline table steps inside Scenario Outlines (#538 Matt Wynne)
16
23
  * Pending in scenario outline is red (#399 Matt Wynne)
17
24
  * Allow optional step arguments to play happily with step transforms (Rob Holland)
18
25
  * Regex escape the path when filtering the backtrace (Corey Donohoe & Simon Rozet)
26
+ * Add gem dependency on JSON gem, required by wire protocol (#533 Matt Wynne)
19
27
 
20
28
  === Removed Features
21
29
  * All Rails-related code is in a separate gem: cucumber-rails. Install that if you're working with Rails. (#483 Aslak Hellesøy)
30
+ * --language is removed: http://wiki.github.com/aslakhellesoy/cucumber/spoken-languages (Aslak Hellesøy)
22
31
 
23
32
  == 0.4.4 2009-11-13
24
33
 
data/Rakefile CHANGED
@@ -16,17 +16,18 @@ begin
16
16
  gem.authors = ["Aslak Hellesøy"]
17
17
  gem.rubyforge_project = "rspec"
18
18
 
19
- gem.add_dependency 'term-ansicolor', '1.0.4'
20
- gem.add_dependency 'treetop', '1.4.2'
21
- gem.add_dependency 'polyglot', '0.2.9'
22
- gem.add_dependency 'builder', '2.1.2'
23
- gem.add_dependency 'diff-lcs', '1.1.2'
24
-
25
- gem.add_development_dependency 'nokogiri', '1.4.0'
26
- gem.add_development_dependency 'prawn', '0.5.1'
27
- gem.add_development_dependency 'rspec', '1.2.9'
28
- gem.add_development_dependency 'spork', '0.7.3'
29
-
19
+ gem.add_dependency 'term-ansicolor', '>= 1.0.4'
20
+ gem.add_dependency 'treetop', '>= 1.4.2'
21
+ gem.add_dependency 'polyglot', '>= 0.2.9'
22
+ gem.add_dependency 'builder', '>= 2.1.2'
23
+ gem.add_dependency 'diff-lcs', '>= 1.1.2'
24
+ gem.add_dependency defined?(JRUBY_VERSION) ? 'json_pure' : 'json', '>= 1.2.0'
25
+
26
+ gem.add_development_dependency 'nokogiri', '>= 1.4.0'
27
+ gem.add_development_dependency 'prawn', '>= 0.5.1'
28
+ gem.add_development_dependency 'rspec', '>= 1.2.9'
29
+ gem.add_development_dependency 'spork', '>= 0.7.4'
30
+
30
31
  extend Cucumber::Formatter::ANSIColor
31
32
  gem.post_install_message = <<-POST_INSTALL_MESSAGE
32
33
 
@@ -1,5 +1,4 @@
1
1
  ---
2
- :patch: 5
2
+ :patch: 0
3
3
  :major: 0
4
- :minor: 4
5
- :build: rc2
4
+ :minor: 5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cucumber}
8
- s.version = "0.4.5.rc2"
8
+ s.version = "0.5.0"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aslak Helles\303\270y"]
12
- s.date = %q{2009-12-07}
12
+ s.date = %q{2009-12-15}
13
13
  s.default_executable = %q{cucumber}
14
14
  s.description = %q{A BDD tool written in Ruby}
15
15
  s.email = %q{cukes@googlegroups.com}
@@ -366,6 +366,7 @@ Gem::Specification.new do |s|
366
366
  "features/unicode_table.feature",
367
367
  "features/usage_and_stepdefs_formatter.feature",
368
368
  "features/wire_protocol.feature",
369
+ "features/wire_protocol_table_diffing.feature",
369
370
  "features/work_in_progress.feature",
370
371
  "gem_tasks/contributors.rake",
371
372
  "gem_tasks/environment.rake",
@@ -524,8 +525,10 @@ Gem::Specification.new do |s|
524
525
  "spec/cucumber/treetop_parser/test_dos.feature",
525
526
  "spec/cucumber/treetop_parser/with_comments.feature",
526
527
  "spec/cucumber/treetop_parser/with_tags.feature",
528
+ "spec/cucumber/wire_support/wire_exception_spec.rb",
527
529
  "spec/cucumber/wire_support/wire_language_spec.rb",
528
530
  "spec/cucumber/wire_support/wire_packet_spec.rb",
531
+ "spec/cucumber/wire_support/wire_step_definition_spec.rb",
529
532
  "spec/cucumber/world/pending_spec.rb",
530
533
  "spec/spec.opts",
531
534
  "spec/spec_helper.rb"
@@ -536,7 +539,7 @@ Gem::Specification.new do |s|
536
539
 
537
540
  (::) U P G R A D I N G (::)
538
541
 
539
- Thank you for installing cucumber-0.4.5.rc2.
542
+ Thank you for installing cucumber-0.5.0.
540
543
  Please be sure to read http://wiki.github.com/aslakhellesoy/cucumber/upgrading
541
544
  for important information about this release. Happy cuking!
542
545
 
@@ -583,8 +586,10 @@ for important information about this release. Happy cuking!
583
586
  "spec/cucumber/rb_support/regexp_argument_matcher_spec.rb",
584
587
  "spec/cucumber/step_match_spec.rb",
585
588
  "spec/cucumber/step_mother_spec.rb",
589
+ "spec/cucumber/wire_support/wire_exception_spec.rb",
586
590
  "spec/cucumber/wire_support/wire_language_spec.rb",
587
591
  "spec/cucumber/wire_support/wire_packet_spec.rb",
592
+ "spec/cucumber/wire_support/wire_step_definition_spec.rb",
588
593
  "spec/cucumber/world/pending_spec.rb",
589
594
  "spec/spec_helper.rb",
590
595
  "examples/i18n/ar/features/step_definitons/calculator_steps.rb",
@@ -706,36 +711,39 @@ for important information about this release. Happy cuking!
706
711
  s.specification_version = 3
707
712
 
708
713
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
709
- s.add_runtime_dependency(%q<term-ansicolor>, ["= 1.0.4"])
710
- s.add_runtime_dependency(%q<treetop>, ["= 1.4.2"])
711
- s.add_runtime_dependency(%q<polyglot>, ["= 0.2.9"])
712
- s.add_runtime_dependency(%q<builder>, ["= 2.1.2"])
713
- s.add_runtime_dependency(%q<diff-lcs>, ["= 1.1.2"])
714
- s.add_development_dependency(%q<nokogiri>, ["= 1.4.0"])
715
- s.add_development_dependency(%q<prawn>, ["= 0.5.1"])
716
- s.add_development_dependency(%q<rspec>, ["= 1.2.9"])
717
- s.add_development_dependency(%q<spork>, ["= 0.7.3"])
714
+ s.add_runtime_dependency(%q<term-ansicolor>, [">= 1.0.4"])
715
+ s.add_runtime_dependency(%q<treetop>, [">= 1.4.2"])
716
+ s.add_runtime_dependency(%q<polyglot>, [">= 0.2.9"])
717
+ s.add_runtime_dependency(%q<builder>, [">= 2.1.2"])
718
+ s.add_runtime_dependency(%q<diff-lcs>, [">= 1.1.2"])
719
+ s.add_runtime_dependency(%q<json>, [">= 1.2.0"])
720
+ s.add_development_dependency(%q<nokogiri>, [">= 1.4.0"])
721
+ s.add_development_dependency(%q<prawn>, [">= 0.5.1"])
722
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
723
+ s.add_development_dependency(%q<spork>, [">= 0.7.4"])
718
724
  else
719
- s.add_dependency(%q<term-ansicolor>, ["= 1.0.4"])
720
- s.add_dependency(%q<treetop>, ["= 1.4.2"])
721
- s.add_dependency(%q<polyglot>, ["= 0.2.9"])
722
- s.add_dependency(%q<builder>, ["= 2.1.2"])
723
- s.add_dependency(%q<diff-lcs>, ["= 1.1.2"])
724
- s.add_dependency(%q<nokogiri>, ["= 1.4.0"])
725
- s.add_dependency(%q<prawn>, ["= 0.5.1"])
726
- s.add_dependency(%q<rspec>, ["= 1.2.9"])
727
- s.add_dependency(%q<spork>, ["= 0.7.3"])
725
+ s.add_dependency(%q<term-ansicolor>, [">= 1.0.4"])
726
+ s.add_dependency(%q<treetop>, [">= 1.4.2"])
727
+ s.add_dependency(%q<polyglot>, [">= 0.2.9"])
728
+ s.add_dependency(%q<builder>, [">= 2.1.2"])
729
+ s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
730
+ s.add_dependency(%q<json>, [">= 1.2.0"])
731
+ s.add_dependency(%q<nokogiri>, [">= 1.4.0"])
732
+ s.add_dependency(%q<prawn>, [">= 0.5.1"])
733
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
734
+ s.add_dependency(%q<spork>, [">= 0.7.4"])
728
735
  end
729
736
  else
730
- s.add_dependency(%q<term-ansicolor>, ["= 1.0.4"])
731
- s.add_dependency(%q<treetop>, ["= 1.4.2"])
732
- s.add_dependency(%q<polyglot>, ["= 0.2.9"])
733
- s.add_dependency(%q<builder>, ["= 2.1.2"])
734
- s.add_dependency(%q<diff-lcs>, ["= 1.1.2"])
735
- s.add_dependency(%q<nokogiri>, ["= 1.4.0"])
736
- s.add_dependency(%q<prawn>, ["= 0.5.1"])
737
- s.add_dependency(%q<rspec>, ["= 1.2.9"])
738
- s.add_dependency(%q<spork>, ["= 0.7.3"])
737
+ s.add_dependency(%q<term-ansicolor>, [">= 1.0.4"])
738
+ s.add_dependency(%q<treetop>, [">= 1.4.2"])
739
+ s.add_dependency(%q<polyglot>, [">= 0.2.9"])
740
+ s.add_dependency(%q<builder>, [">= 2.1.2"])
741
+ s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
742
+ s.add_dependency(%q<json>, [">= 1.2.0"])
743
+ s.add_dependency(%q<nokogiri>, [">= 1.4.0"])
744
+ s.add_dependency(%q<prawn>, [">= 0.5.1"])
745
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
746
+ s.add_dependency(%q<spork>, [">= 0.7.4"])
739
747
  end
740
748
  end
741
749
 
@@ -4,7 +4,7 @@ rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format
4
4
  std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
5
5
  %>
6
6
  default: <%= std_opts %>
7
- jruby: <%= std_opts %>,~@spork
7
+ jruby: <%= std_opts %>,~@spork,~@wire
8
8
  run_code_run: <%= std_opts %>,~@spork
9
9
  windows_mri: <%= std_opts %>,~@spork
10
10
  wip: --tags @wip:3 --wip features
@@ -3,7 +3,7 @@ Feature: Language help
3
3
  I want to be able to get help on the language from the CLI
4
4
 
5
5
  Scenario: Get help for Portuguese language
6
- When I run cucumber -l pt help
6
+ When I run cucumber --i18n pt help
7
7
  Then it should pass with
8
8
  """
9
9
  | name | Portuguese |
@@ -21,7 +21,7 @@ Feature: Language help
21
21
 
22
22
  """
23
23
  Scenario: List languages
24
- When I run cucumber -l help
24
+ When I run cucumber --i18n help
25
25
  Then it should pass with
26
26
  """
27
27
  | ar | Arabic | العربية |
@@ -5,19 +5,26 @@ Feature: Wire Protocol
5
5
  I want a low-level protocol which Cucumber can use to run steps within my app
6
6
 
7
7
  #
8
- # Cucumber's wire protocol is an implementation of Cucumber's internal 'programming language' abstraction,
9
- # and allows step definitions to be implemented and invoked on any platform.
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.
10
11
  #
11
- # Communication is over a TCP socket, which Cucumber connects to when it finds a definition file with the
12
- # .wire extension in the step_definitions folder (or other load path).
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).
13
15
  #
14
- # There are currently two messages which Cucumber sends over the wire:
16
+ # Cucumber currently sends the following messages over the wire:
15
17
  #
16
- # * step_matches : this is used to find out whether the wire end has a definition for a given step
17
- # * invoke : this is used to ask for a step definition to be invoked
18
+ # * step_matches : this is used to find out whether the wire end 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
18
24
  #
19
- # Message packets are formatted as JSON-encoded strings, with a newline character signalling the end of a
20
- # packet. These messages are described below, with examples.
25
+ # Message packets are formatted as JSON-encoded strings, with a newline
26
+ # character signalling the end of a packet. These messages are described
27
+ # below, with examples.
21
28
  #
22
29
 
23
30
  Background:
@@ -39,16 +46,18 @@ Feature: Wire Protocol
39
46
  #
40
47
  # step_matches
41
48
  #
42
- # When the features have been parsed, Cucumber will send a step_matches message to ask the wire end
43
- # if it can match a step name. This happens for each of the steps in each of the features.
44
- # The wire end replies with a step_match array, containing the IDs of any step definitions that could
45
- # be invoked for the given step name.
49
+ # When the features have been parsed, Cucumber will send a step_matches
50
+ # message to ask the wire end if it can match a step name. This happens for
51
+ # each of the steps in each of the features.
52
+ #
53
+ # The wire end replies with a step_match array, containing the IDs of any step
54
+ # definitions that could be invoked for the given step name.
46
55
 
47
56
  Scenario: Dry run finds no step match
48
57
  Given there is a wire server running on port 54321 which understands the following protocol:
49
58
  | request | response |
50
59
  | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[]] |
51
- When I run cucumber --dry-run -f progress features
60
+ When I run cucumber --dry-run -f progress
52
61
  And it should pass with
53
62
  """
54
63
  U
@@ -58,17 +67,18 @@ Feature: Wire Protocol
58
67
 
59
68
  """
60
69
 
61
- # When a step match is returned, it contains an identifier for the step definition to be used
62
- # later when referring to this step definition again if it needs to be invoked. The identifier
63
- # can take any form (as long as it's within a string) and is simply used for the wire end's own
64
- # reference.
65
- # The step match also contains any argument values as parsed out by the wire end's own regular
66
- # expression or other argument matching process.
70
+ # When a step match is returned, it contains an identifier for the step
71
+ # definition to be used later when referring to this step definition again if
72
+ # it needs to be invoked. The identifier can take any form (as long as it's
73
+ # within a string) and is simply used for the wire end's own reference.
74
+ #
75
+ # The step match also contains any argument values as parsed out by the wire
76
+ # end's own regular expression or other argument matching process.
67
77
  Scenario: Dry run finds a step match
68
78
  Given there is a wire server running on port 54321 which understands the following protocol:
69
79
  | request | response |
70
80
  | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
71
- When I run cucumber --dry-run -f progress features
81
+ When I run cucumber --dry-run -f progress
72
82
  And it should pass with
73
83
  """
74
84
  -
@@ -78,16 +88,60 @@ Feature: Wire Protocol
78
88
 
79
89
  """
80
90
 
91
+ # Optionally, the step match can also contain the a source reference, and a
92
+ # native regexp string which will be used by some formatters
93
+ Scenario: Step matches returns details about the remote step definition
94
+ Given there is a wire server running on port 54321 which understands the following protocol:
95
+ | request | response |
96
+ | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[], "source":"MyApp.MyClass:123", "regexp":"we.*"}]] |
97
+ When I run cucumber -f stepdefs --dry-run
98
+ Then STDERR should be empty
99
+ And it should pass with
100
+ """
101
+ -
102
+
103
+ we.* # MyApp.MyClass:123
104
+
105
+ 1 scenario (1 skipped)
106
+ 1 step (1 skipped)
107
+
108
+ """
109
+
81
110
 
82
111
  #
83
112
  # invoke
84
113
  #
85
- # Assuming a step_match was returned for a given step name, when it's time to invoke that
86
- # step definition, Cucumber will send an invoke message.
87
- # The message contains the ID of the step definition, as returned by the wire end from the
88
- # step_matches call, along with the arguments that were parsed from the step name during the
89
- # same step_matches call.
90
- # The wire end will reply with either a step_failed or a success message.
114
+ # Assuming a step_match was returned for a given step name, when it's time to
115
+ # invoke that step definition, Cucumber will send an invoke message.
116
+ #
117
+ # The message contains the ID of the step definition, as returned by the wire
118
+ # end from the step_matches call, along with the arguments that were parsed
119
+ # from the step name during the same step_matches call.
120
+ #
121
+ # The wire end will reply with either a step_failed, success, or pending message.
122
+
123
+ # The message argument which accompanies the pending message is optional
124
+ Scenario: Invoke a step definition which is pending
125
+ Given there is a wire server running on port 54321 which understands the following protocol:
126
+ | request | response |
127
+ | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
128
+ | ["begin_scenario",null] | ["success", null] |
129
+ | ["invoke",{"id":"1","args":[]}] | ["pending", "I'll do it later"] |
130
+ | ["end_scenario",null] | ["success", null] |
131
+ When I run cucumber -f pretty -q
132
+ And it should pass with
133
+ """
134
+
135
+
136
+ Scenario: Wired
137
+ Given we're all wired
138
+ I'll do it later (Cucumber::Pending)
139
+ features/wired.feature:2:in `Given we're all wired'
140
+
141
+ 1 scenario (1 pending)
142
+ 1 step (1 pending)
143
+
144
+ """
91
145
 
92
146
  Scenario: Invoke a step definition which passes
93
147
  Given there is a wire server running on port 54321 which understands the following protocol:
@@ -96,7 +150,7 @@ Feature: Wire Protocol
96
150
  | ["begin_scenario",null] | ["success",null] |
97
151
  | ["invoke",{"id":"1","args":[]}] | ["success",null] |
98
152
  | ["end_scenario",null] | ["success",null] |
99
- When I run cucumber -f progress --backtrace features
153
+ When I run cucumber -f progress
100
154
  And it should pass with
101
155
  """
102
156
  .
@@ -106,17 +160,18 @@ Feature: Wire Protocol
106
160
 
107
161
  """
108
162
 
109
- # When a step definition fails, it can return details of the exception in the reply to invoke. These
110
- # will then be passed by Cucumber to the formatters for display to the user.
163
+ # When an invoked step definition fails, it can return details of the exception
164
+ # in the reply to invoke. These will then be passed by Cucumber to the formatters
165
+ # for display to the user.
111
166
  #
112
167
  Scenario: Invoke a step definition which fails
113
168
  Given there is a wire server running on port 54321 which understands the following protocol:
114
- | request | response |
115
- | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
116
- | ["begin_scenario",null] | ["success",null] |
117
- | ["invoke",{"id":"1","args":[]}] | ["step_failed",{"message":"The wires are down"}] |
118
- | ["end_scenario",null] | ["success",null] |
119
- When I run cucumber -f progress features
169
+ | request | response |
170
+ | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
171
+ | ["begin_scenario",null] | ["success",null] |
172
+ | ["invoke",{"id":"1","args":[]}] | ["step_failed",{"message":"The wires are down", "exception":"Some.Foreign.ExceptionType"}] |
173
+ | ["end_scenario",null] | ["success",null] |
174
+ When I run cucumber -f progress
120
175
  Then STDERR should be empty
121
176
  And it should fail with
122
177
  """
@@ -124,7 +179,7 @@ Feature: Wire Protocol
124
179
 
125
180
  (::) failed steps (::)
126
181
 
127
- The wires are down (Cucumber::WireSupport::WireException)
182
+ The wires are down (Some.Foreign.ExceptionType from localhost:54321)
128
183
  features/wired.feature:2:in `Given we're all wired'
129
184
 
130
185
  Failing Scenarios:
@@ -137,24 +192,27 @@ Feature: Wire Protocol
137
192
 
138
193
  # Imagine we have a step definition like:
139
194
  #
140
- # Given /we're all (.*)/ do |what_we_are|
195
+ # Given /we're all (.*)/ do | what_we_are |
141
196
  # end
142
197
  #
143
- # When this step definition matches the step name in our feature, the word 'wired' will be parsed as an
144
- # argument.
198
+ # When this step definition matches the step name in our feature, the word
199
+ # 'wired' will be parsed as an argument.
145
200
  #
146
- # Cucumber expects this StepArgument to be returned in the StepMatch. The keys have the following meanings:
147
- # * val : the value of the string captured for that argument from the step name passed in step_matches
148
- # * pos : the position within the step name that the argument was matched (used for formatter highlighting)
201
+ # Cucumber expects this StepArgument to be returned in the StepMatch. The keys
202
+ # have the following meanings:
203
+ # * val : the value of the string captured for that argument from the step
204
+ # name passed in step_matches
205
+ # * pos : the position within the step name that the argument was matched
206
+ # (used for formatter highlighting)
149
207
  #
150
- Scenario: Invoke a step definition which takes arguments (and passes)
208
+ Scenario: Invoke a step definition which takes string arguments (and passes)
151
209
  Given there is a wire server running on port 54321 which understands the following protocol:
152
210
  | request | response |
153
211
  | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[{"val":"wired", "pos":10}]}]] |
154
212
  | ["begin_scenario",null] | ["success",null] |
155
213
  | ["invoke",{"id":"1","args":["wired"]}] | ["success",null] |
156
214
  | ["end_scenario",null] | ["success",null] |
157
- When I run cucumber -f progress --backtrace features
215
+ When I run cucumber -f progress
158
216
  Then STDERR should be empty
159
217
  And it should pass with
160
218
  """
@@ -165,12 +223,73 @@ Feature: Wire Protocol
165
223
 
166
224
  """
167
225
 
226
+ # When the step has a multiline table argument, it will be passed with the
227
+ # invoke message as a string - a serialized JSON array of array of strings.
228
+ # In the following scenario our step definition takes two arguments - one
229
+ # captures the "we're" and the other takes the table.
230
+ Scenario: Invoke a step definition which takes table arguments (and passes)
231
+ Given a file named "features/wired_on_tables.feature" with:
232
+ """
233
+ Scenario: Wired and more
234
+ Given we're all:
235
+ | wired |
236
+ | high |
237
+ | happy |
238
+ """
239
+ And 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:"}] | ["step_matches",[{"id":"1", "args":[{"val":"we're", "pos":0}]}]] |
242
+ | ["begin_scenario",null] | ["success",null] |
243
+ | ["invoke",{"id":"1","args":["we're",[["wired"],["high"],["happy"]]]}] | ["success",null] |
244
+ | ["end_scenario",null] | ["success",null] |
245
+ When I run cucumber -f progress features/wired_on_tables.feature
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
+
257
+ #
258
+ # snippets
259
+ #
260
+ Scenario: Wire server returns snippets for a step that didn't match
261
+ Given there is a wire server running on port 54321 which understands the following protocol:
262
+ | request | response |
263
+ | ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[]] |
264
+ | ["snippet_text",{"step_keyword":"Given","multiline_arg_class":"","step_name":"we're all wired"}] | ["snippet_text","foo()\n bar;\nbaz"] |
265
+ | ["begin_scenario",null] | ["success",null] |
266
+ | ["end_scenario",null] | ["success",null] |
267
+ When I run cucumber -f pretty
268
+ And it should pass with
269
+ """
270
+
271
+
272
+ Scenario: Wired # features/wired.feature:1
273
+ Given we're all wired # features/wired.feature:2
274
+
275
+ 1 scenario (1 undefined)
276
+ 1 step (1 undefined)
277
+
278
+ You can implement step definitions for undefined steps with these snippets:
279
+
280
+ foo()
281
+ bar;
282
+ baz
283
+
284
+
285
+ """
286
+
168
287
 
169
288
  Scenario: Unexpected response
170
289
  Given there is a wire server running on port 54321 which understands the following protocol:
171
- | request | response |
172
- | ["begin_scenario",null] | ["yikes"] |
173
- When I run cucumber -f progress features
290
+ | request | response |
291
+ | ["begin_scenario",null] | ["yikes"] |
292
+ When I run cucumber -f progress
174
293
  Then STDERR should match
175
294
  """
176
295
  undefined method `handle_yikes'