Skip to content
This repository
Newer
Older
100644 119 lines (95 sloc) 5.553 kb
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
1 @wire
2 Feature: Wire protocol table diffing
3 In order to use the amazing functionality in the Cucumber table object
4 As a wire server
5 I want to be able to ask for a table diff during a step definition invocation
6
7 Background:
8 Given a standard Cucumber project directory structure
9 And a file named "features/wired.feature" with:
10 """
a20c5e24 » aslakhellesoy
2010-04-18 1 failure
11 Feature: Hello
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
12 Scenario: Wired
13 Given we're all wired
14
15 """
16 And a file named "features/step_definitions/some_remote_place.wire" with:
17 """
18 host: localhost
19 port: 54321
20
21 """
22
23 Scenario: Invoke a step definition tries to diff the table and fails
24 Given there is a wire server running on port 54321 which understands the following protocol:
47e2cfc9 » mattwynne
2009-12-22 Update features to match simplified wire protocol response messages
25 | request | response |
26 | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
365cb673 » mattwynne
2009-12-22 Remove noisy null params from wire protocol packets
27 | ["begin_scenario"] | ["success"] |
47e2cfc9 » mattwynne
2009-12-22 Update features to match simplified wire protocol response messages
28 | ["invoke",{"id":"1","args":[]}] | ["diff",[[["a","b"],["c","d"]],[["x","y"],["z","z"]]]] |
365cb673 » mattwynne
2009-12-22 Remove noisy null params from wire protocol packets
29 | ["diff_failed"] | ["fail",{"message":"Not same", "exception":"DifferentException", "backtrace":["a.cs:12","b.cs:34"]}] |
30 | ["end_scenario"] | ["success"] |
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
31 When I run cucumber -f progress --backtrace
a20c5e24 » aslakhellesoy
2010-04-18 1 failure
32 Then STDERR should be empty
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
33 And it should fail with
34 """
35 F
36
37 (::) failed steps (::)
38
39 Not same (DifferentException from localhost:54321)
40 a.cs:12
41 b.cs:34
a20c5e24 » aslakhellesoy
2010-04-18 1 failure
42 features/wired.feature:3:in `Given we're all wired'
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
43
44 Failing Scenarios:
a20c5e24 » aslakhellesoy
2010-04-18 1 failure
45 cucumber features/wired.feature:2 # Scenario: Wired
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
46
47 1 scenario (1 failed)
48 1 step (1 failed)
49
50 """
51
52 Scenario: Invoke a step definition tries to diff the table and passes
53 Given there is a wire server running on port 54321 which understands the following protocol:
47e2cfc9 » mattwynne
2009-12-22 Update features to match simplified wire protocol response messages
54 | request | response |
55 | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
365cb673 » mattwynne
2009-12-22 Remove noisy null params from wire protocol packets
56 | ["begin_scenario"] | ["success"] |
47e2cfc9 » mattwynne
2009-12-22 Update features to match simplified wire protocol response messages
57 | ["invoke",{"id":"1","args":[]}] | ["diff",[[["a"],["b"]],[["a"],["b"]]]] |
365cb673 » mattwynne
2009-12-22 Remove noisy null params from wire protocol packets
58 | ["diff_ok"] | ["success"] |
59 | ["end_scenario"] | ["success"] |
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
60 When I run cucumber -f progress
61 And it should pass with
62 """
63 .
64
65 1 scenario (1 passed)
66 1 step (1 passed)
67
68 """
69
70 Scenario: Invoke a step definition which successfully diffs a table but then fails
71 Given there is a wire server running on port 54321 which understands the following protocol:
47e2cfc9 » mattwynne
2009-12-22 Update features to match simplified wire protocol response messages
72 | request | response |
73 | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
365cb673 » mattwynne
2009-12-22 Remove noisy null params from wire protocol packets
74 | ["begin_scenario"] | ["success"] |
47e2cfc9 » mattwynne
2009-12-22 Update features to match simplified wire protocol response messages
75 | ["invoke",{"id":"1","args":[]}] | ["diff",[[["a"],["b"]],[["a"],["b"]]]] |
365cb673 » mattwynne
2009-12-22 Remove noisy null params from wire protocol packets
76 | ["diff_ok"] | ["fail",{"message":"I wanted things to be different for us"}] |
77 | ["end_scenario"] | ["success"] |
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
78 When I run cucumber -f progress
79 And it should fail with
80 """
81 F
82
83 (::) failed steps (::)
84
85 I wanted things to be different for us (Cucumber::WireSupport::WireException)
a20c5e24 » aslakhellesoy
2010-04-18 1 failure
86 features/wired.feature:3:in `Given we're all wired'
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
87
88 Failing Scenarios:
a20c5e24 » aslakhellesoy
2010-04-18 1 failure
89 cucumber features/wired.feature:2 # Scenario: Wired
db1ac69d » mattwynne
2009-12-12 Add support for table diffing to wire protocol
90
91 1 scenario (1 failed)
92 1 step (1 failed)
93
94 """
f47bd230 » mattwynne
2010-01-18 Add diff! message to wire_protocol to allow clients to more easily sa…
95
96 Scenario: Invoke a step definition which asks for an immediate diff that fails
97 Given there is a wire server running on port 54321 which understands the following protocol:
98 | request | response |
99 | ["step_matches",{"name_to_match":"we're all wired"}] | ["success",[{"id":"1", "args":[]}]] |
100 | ["begin_scenario"] | ["success"] |
101 | ["invoke",{"id":"1","args":[]}] | ["diff!",[[["a"]],[["b"]]]] |
102 | ["end_scenario"] | ["success"] |
103 When I run cucumber -f progress
104 And it should fail with
105 """
106 F
107
108 (::) failed steps (::)
109
110 Tables were not identical (Cucumber::Ast::Table::Different)
a20c5e24 » aslakhellesoy
2010-04-18 1 failure
111 features/wired.feature:3:in `Given we're all wired'
f47bd230 » mattwynne
2010-01-18 Add diff! message to wire_protocol to allow clients to more easily sa…
112
113 Failing Scenarios:
a20c5e24 » aslakhellesoy
2010-04-18 1 failure
114 cucumber features/wired.feature:2 # Scenario: Wired
f47bd230 » mattwynne
2010-01-18 Add diff! message to wire_protocol to allow clients to more easily sa…
115
116 1 scenario (1 failed)
117 1 step (1 failed)
118
119 """
Something went wrong with that request. Please try again.