pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 479 forks source link

interaction missing in generated json file #691

Open lukasl66 opened 6 years ago

lukasl66 commented 6 years ago

I defined multiple Pact consumer tests by utilizing a junit test class. All tests succeeded. However, when I examined the generated json file I found out that it was missing one interaction. Close inspection reveals that one interaction will not be included in the generated json file if the following condition applies: 2 Pacts (methods with @Pact annotation) have the same description (argument of uponReceiving() method. Other attributes of the interaction may vary.

This must be unintended behaviour, right?

I did not find anything in the documentation that says that descriptions of interactions must be unique in the pact. One might argue that it is not good style to use the same description text for different interactions. However this may happen unintentionally. In thas case it's likely that the consumer publishes the pact without even knowing that it does not contain all interactions he defined.

Thanks for the help!

uglyog commented 6 years ago

The description and state must be unique, otherwise they will overwrite each other. But you are correct that that is not explicitly documented.

lukasl66 commented 6 years ago

Ok, thanks for clarifying!