Skip to content

Commit

Permalink
Update features to match simplified wire protocol response messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwynne committed Dec 22, 2009
1 parent 6303c10 commit 47e2cfc
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 63 deletions.
83 changes: 43 additions & 40 deletions features/wire_protocol.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Feature: Wire Protocol
#
# Cucumber currently sends the following messages over the wire:
#
# * step_matches : this is used to find out whether the wire end has a
# * step_matches : this is used to find out whether the wire server has a
# definition for a given step
# * invoke : this is used to ask for a step definition to be invoked
# * begin_scenario : signals that cucumber is about to execute a scenario
Expand Down Expand Up @@ -47,16 +47,16 @@ Feature: Wire Protocol
# step_matches
#
# When the features have been parsed, Cucumber will send a step_matches
# message to ask the wire end if it can match a step name. This happens for
# message to ask the wire server if it can match a step name. This happens for
# each of the steps in each of the features.
#
# The wire end replies with a step_match array, containing the IDs of any step
# The wire server replies with a step_match array, containing the IDs of any step
# definitions that could be invoked for the given step name.

Scenario: Dry run finds no step match
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[]] |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
When I run cucumber --dry-run -f progress
And it should pass with
"""
Expand All @@ -70,14 +70,14 @@ Feature: Wire Protocol
# When a step match is returned, it contains an identifier for the step
# definition to be used later when referring to this step definition again if
# it needs to be invoked. The identifier can take any form (as long as it's
# within a string) and is simply used for the wire end's own reference.
# within a string) and is simply used for the wire server's own reference.
#
# The step match also contains any argument values as parsed out by the wire
# end's own regular expression or other argument matching process.
Scenario: Dry run finds a step match
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
When I run cucumber --dry-run -f progress
And it should pass with
"""
Expand All @@ -92,8 +92,8 @@ Feature: Wire Protocol
# native regexp string which will be used by some formatters
Scenario: Step matches returns details about the remote step definition
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[], "source":"MyApp.MyClass:123", "regexp":"we.*"}]] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[], "source":"MyApp.MyClass:123", "regexp":"we.*"}]] |
When I run cucumber -f stepdefs --dry-run
Then STDERR should be empty
And it should pass with
Expand All @@ -118,16 +118,19 @@ Feature: Wire Protocol
# end from the step_matches call, along with the arguments that were parsed
# from the step name during the same step_matches call.
#
# The wire end will reply with either a step_failed, success, or pending message.
# The wire server will normally[1] reply with either a 'success', 'fail', or
# 'pending' message.
#
# [1] See also wire_protocol_table_diffing.feature

# The message argument which accompanies the pending message is optional
Scenario: Invoke a step definition which is pending
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success", null] |
| ["invoke",{"id":"1","args":[]}] | ["pending", "I'll do it later"] |
| ["end_scenario",null] | ["success", null] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success", null] |
| ["invoke",{"id":"1","args":[]}] | ["pending", "I'll do it later"] |
| ["end_scenario",null] | ["success", null] |
When I run cucumber -f pretty -q
And it should pass with
"""
Expand All @@ -145,11 +148,11 @@ Feature: Wire Protocol

Scenario: Invoke a step definition which passes
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
When I run cucumber -f progress
And it should pass with
"""
Expand All @@ -166,11 +169,11 @@ Feature: Wire Protocol
#
Scenario: Invoke a step definition which fails
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["step_failed",{"message":"The wires are down", "exception":"Some.Foreign.ExceptionType"}] |
| ["end_scenario",null] | ["success",null] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["fail",{"message":"The wires are down", "exception":"Some.Foreign.ExceptionType"}] |
| ["end_scenario",null] | ["success",null] |
When I run cucumber -f progress
Then STDERR should be empty
And it should fail with
Expand Down Expand Up @@ -207,11 +210,11 @@ Feature: Wire Protocol
#
Scenario: Invoke a step definition which takes string arguments (and passes)
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[{"val":"wired", "pos":10}]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":["wired"]}] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[{"val":"wired", "pos":10}]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":["wired"]}] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
When I run cucumber -f progress
Then STDERR should be empty
And it should pass with
Expand All @@ -237,11 +240,11 @@ Feature: Wire Protocol
| happy |
"""
And there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all:"}] | ["step_matches",[{"id":"1", "args":[{"val":"we're", "pos":0}]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":["we're",[["wired"],["high"],["happy"]]]}] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
| request | response |
| ["step_matches",{"name_to_match":"we're all:"}] | ["success",[{"id":"1", "args":[{"val":"we're", "pos":0}]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":["we're",[["wired"],["high"],["happy"]]]}] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
When I run cucumber -f progress features/wired_on_tables.feature
Then STDERR should be empty
And it should pass with
Expand All @@ -259,11 +262,11 @@ Feature: Wire Protocol
#
Scenario: Wire server returns snippets for a step that didn't match
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[]] |
| ["snippet_text",{"step_keyword":"Given","multiline_arg_class":"","step_name":"we're all wired"}] | ["snippet_text","foo()\n bar;\nbaz"] |
| ["begin_scenario",null] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[]] |
| ["snippet_text",{"step_keyword":"Given","multiline_arg_class":"","step_name":"we're all wired"}] | ["success","foo()\n bar;\nbaz"] |
| ["begin_scenario",null] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
When I run cucumber -f pretty
And it should pass with
"""
Expand Down
36 changes: 18 additions & 18 deletions features/wire_protocol_table_diffing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ Feature: Wire protocol table diffing

Scenario: Invoke a step definition tries to diff the table and fails
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["diff",[[["a","b"],["c","d"]],[["x","y"],["z","z"]]]] |
| ["diff_failed",null] | ["step_failed",{"message":"Not same", "exception":"DifferentException", "backtrace":["a.cs:12","b.cs:34"]}] |
| ["end_scenario",null] | ["success",null] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["diff",[[["a","b"],["c","d"]],[["x","y"],["z","z"]]]] |
| ["diff_failed",null] | ["fail",{"message":"Not same", "exception":"DifferentException", "backtrace":["a.cs:12","b.cs:34"]}] |
| ["end_scenario",null] | ["success",null] |
When I run cucumber -f progress --backtrace
And it should fail with
"""
Expand All @@ -49,12 +49,12 @@ Feature: Wire protocol table diffing

Scenario: Invoke a step definition tries to diff the table and passes
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["diff",[[["a"],["b"]],[["a"],["b"]]]] |
| ["diff_ok",null] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["diff",[[["a"],["b"]],[["a"],["b"]]]] |
| ["diff_ok",null] | ["success",null] |
| ["end_scenario",null] | ["success",null] |
When I run cucumber -f progress
And it should pass with
"""
Expand All @@ -67,12 +67,12 @@ Feature: Wire protocol table diffing

Scenario: Invoke a step definition which successfully diffs a table but then fails
Given there is a wire server running on port 54321 which understands the following protocol:
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["step_matches",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["diff",[[["a"],["b"]],[["a"],["b"]]]] |
| ["diff_ok",null] | ["step_failed",{"message":"I wanted things to be different for us"}] |
| ["end_scenario",null] | ["success",null] |
| request | response |
| ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
| ["begin_scenario",null] | ["success",null] |
| ["invoke",{"id":"1","args":[]}] | ["diff",[[["a"],["b"]],[["a"],["b"]]]] |
| ["diff_ok",null] | ["fail",{"message":"I wanted things to be different for us"}] |
| ["end_scenario",null] | ["success",null] |
When I run cucumber -f progress
And it should fail with
"""
Expand Down
Loading

0 comments on commit 47e2cfc

Please sign in to comment.