David Lewine
David Lewine

Reputation: 141

Automate a check that the message provider tests cover all scenarios in pact file?

In http based provider verification the consumer can be sure that if the provider verifies its code against the pact file (e.g. using the maven verify command), all scenarios (requests) in the pact file will be tested against the providers code. This doesn't seem to be the case with message based provider verification. In the message based case, the consumer has to hope that the provider tests have test methods that produce messages for all the scenarios (message types) in the pact file. For example, if the permissible format for the value of a message's phone number field was determined by the value of the message's country field, there might be two messages/scenarios in the pact file, one with a US country code and one with an IN country code. The country code would have to be matched exactly and the phone number field would have to match different regular expressions in the two pact file scenarios. I realize there is no control over how much of the provider code involved in producing a message is tested, but at least automating a check that the provider has a test for each message in the pact file might help keep the consumer and provider in synch. Any ideas on how this might be accomplished? Or is the goal at odds with the message pact zeitgeist?

Upvotes: 0

Views: 46

Answers (1)

Matthew Fellows
Matthew Fellows

Reputation: 4065

In the message based case, the consumer has to hope that the provider tests have test methods that produce messages for all the scenarios (message types) in the pact file

I don't follow this. If the provider doesn't produce valid responses for all of the messages in a Pact file, the pact test should fail.

Are you not seeing this in your particular language?

Upvotes: 1

Related Questions