Skip to content

Commit 8a131f9

Browse files
committed
Squashed 'compatibility-suite/pact-compatibility-suite/' changes from ad77df02b..5c1ea808c
5c1ea808c feat: Add V3 message consumer feature git-subtree-dir: compatibility-suite/pact-compatibility-suite git-subtree-split: 5c1ea808c684df07cfc99ccf4e610bad9b9a13b9
1 parent e40f5ef commit 8a131f9

File tree

2 files changed

+79
-1
lines changed

2 files changed

+79
-1
lines changed

compatibility-suite/pact-compatibility-suite/features/V3/http_generators.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Feature: V3 era Generators applied to HTTP parts
2828
| body | generators |
2929
| file: basic.json | randomint-generator.json |
3030
When the request is prepared for use
31-
Then the body value for "$.one" will have been replaced with a "integer"
31+
Then the body value for "$.one" will have been replaced with an "integer"
3232

3333
Scenario: Supports using a generator with the response status
3434
Given a response configured with the following generators:
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
@consumer
2+
Feature: Message consumer
3+
Supports V3 message consumer interactions
4+
5+
Scenario: When all messages are successfully processed
6+
Given a message integration is being defined for a consumer test
7+
And the message payload contains the "basic" JSON document
8+
When the message is successfully processed
9+
Then the received message payload will contain the "basic" JSON document
10+
And the received message content type will be "application/json"
11+
And the consumer test will have passed
12+
And a Pact file for the message interaction will have been written
13+
And the pact file will contain 1 message interaction
14+
And the first message in the pact file will contain the "basic.json" document
15+
And the first message in the pact file content type will be "application/json"
16+
17+
Scenario: When not all messages are successfully processed
18+
Given a message integration is being defined for a consumer test
19+
And the message payload contains the "basic" JSON document
20+
When the message is NOT successfully processed with a "Test failed" exception
21+
Then the consumer test will have failed
22+
And the consume test error will be "Test failed"
23+
And a Pact file for the message interaction will NOT have been written
24+
25+
Scenario: Supports arbitrary message metadata
26+
Given a message integration is being defined for a consumer test
27+
And the message payload contains the "basic" JSON document
28+
And the message contains the following metadata:
29+
| key | value |
30+
| Origin | Some Text |
31+
| TagData | JSON: { "ID": "sjhdjkshsdjh", "weight": 100.5 } |
32+
When the message is successfully processed
33+
Then the received message metadata will contain "Origin" == "Some Text"
34+
And the received message metadata will contain "TagData" == "JSON: { \"ID\": \"sjhdjkshsdjh\", \"weight\": 100.5 }"
35+
And a Pact file for the message interaction will have been written
36+
And the first message in the pact file will contain the message metadata "Origin" == "Some Text"
37+
And the first message in the pact file will contain the message metadata "TagData" == "JSON: { \"ID\": \"sjhdjkshsdjh\", \"weight\": 100.5 }"
38+
39+
Scenario: Supports specifying provider states
40+
Given a message integration is being defined for a consumer test
41+
And a provider state "state one" for the message is specified
42+
And a provider state "state two" for the message is specified
43+
And a message is defined
44+
When the message is successfully processed
45+
Then a Pact file for the message interaction will have been written
46+
And the first message in the pact file will contain 2 provider states
47+
And the first message in the Pact file will contain provider state "state one"
48+
And the first message in the Pact file will contain provider state "state two"
49+
50+
Scenario: Supports data for provider states
51+
Given a message integration is being defined for a consumer test
52+
And a provider state "a user exists" for the message is specified with the following data:
53+
| username | name | age |
54+
| "Test" | "Test Guy" | 66 |
55+
And a message is defined
56+
When the message is successfully processed
57+
Then a Pact file for the message interaction will have been written
58+
And the first message in the pact file will contain 1 provider state
59+
And the provider state "a user exists" for the message will contain the following parameters:
60+
| parameters |
61+
| {"age":66,"name":"Test Guy","username":"Test"} |
62+
63+
Scenario: Supports the use of generators with the message body
64+
Given a message integration is being defined for a consumer test
65+
And the message configured with the following:
66+
| body | generators |
67+
| file: basic.json | randomint-generator.json |
68+
When the message is successfully processed
69+
Then the message contents for "$.one" will have been replaced with an "integer"
70+
71+
Scenario: Supports the use of generators with message metadata
72+
Given a message integration is being defined for a consumer test
73+
And the message configured with the following:
74+
| generators | metadata |
75+
| JSON: { "metadata": { "ID": { "type": "RandomInt", "min": 0, "max": 1000 } } } | { "ID": "sjhdjkshsdjh", "weight": 100.5 } |
76+
When the message is successfully processed
77+
Then the received message metadata will contain "weight" == "JSON: 100.5"
78+
And the received message metadata will contain "ID" replaced with an "integer"

0 commit comments

Comments
 (0)