|
| 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