Hi, We have a contract with another team as follow...
# pactflow
a
Hi, We have a contract with another team as follows: { "TypeOfPayload": "A", "Details": [ { "ID": "000-AAZ", "Quantity": "1", "HashTags": [ "aa-000" ], "SubIds": [ "aaa-zzzz-700000000" ] } ] } Because the message provider breaks the contracts too often, which breaks our system as well, so we really want to use Pactflow to verify the following contracts: 1. The value for "TypeOfPayload" should either be "A", "B", or "D". 2. The "Quantity" value should match the count of SubIds array elements. 3. If the "TypeOfPayload" value is "B", then "HashTags" should not be null or empty. Can we use Pactflow to create the contract on the broker for the message provider to verify?
y
Yes, see https://docs.pact.io/getting_started/how_pact_works#non-http-testing-message-pact 1. you can marshal the message type via enum matchers 2. you can setup a state based scenario for this type of scenario 3. same as 2 Just remember with Message Pact you aren’t testing the transport mechanism (kafka) but the message handler, so its important to separate them in your code