5

I am trying to introduce Pact framework in our company, and one of the concerns raised was below:

Scenario : This xyz API is called by 40 consumers, every consumer needs the same functionalities currently. So why should we maintain 40 Pact Files as opposed to just maintaining a single file?

Is there any better approach than to have ONE pact file for EACH consumer, considering the pact file maintainence?

River
  • 8,585
  • 14
  • 54
  • 67
PaChSu
  • 297
  • 3
  • 13

1 Answers1

2

If you have 40 consumers using exactly the same functionalities, there wouldn't be an issue with using a single pact file for all those interactions.

However, I find this extremely hard to believe that this is your case and as far as I've seen it in reality, never actually happens. Your provider might have all this functionality, but each consumer doesn't have to test for that functionality unless your consumer actually uses it. Furthermore, each consumer might have a different way to call/access this functionality with different type of data, headers or URL, which makes it unique and needed to test the provider fully for all potential edge cases.

Also, unless the consumer updates to use this new functionality, there's no reason to update the pact file. The point is to try to create independent files for each consumer-provider interaction; this does however increase maintenance when you have multiple consumers to a provider.

We will take your feedback and see what we can do for the future of the product to make this maintenance easier to do or minimize the impact.

J_A_X
  • 12,857
  • 1
  • 25
  • 31
  • 1
    Does every consumer use every single field? If a consumer doesn't use or care about a field, then don't include it in the pact file. This enables a provider to see immediately which consumers would be affected by a change to that field when they run their verification specs. If you actually have 40 consumers of an API, then perhaps they could be using a shared client library, and the pact would just be between the client library and the API. – Beth Skurrie May 11 '17 at 23:06
  • Yes the API is something like download file from a shared drive. So all the consumers expect the same output. – PaChSu May 12 '17 at 03:53