pact-foundation / pact-mock_service

Provides a mock service for use with Pact
https://pact.io
MIT License
73 stars 69 forks source link

Count the number requests matching an interaction #107

Closed AMCR closed 5 years ago

AMCR commented 5 years ago

When I was running my tests against pact-mock_service before pushing the contracts to the Pact Broker.

At the moment I have one scenario where my service calls the pact-mock-service multiple times for the same interaction. My issue is that I need to figure out how many times an interaction was called.

Before doing any changes, I've decided to explore the service and see if there is any other endpoint that I could use for this purpose. I couldn't find a good way to sort out this problem without adding/updating the routes.

bethesque commented 5 years ago

@AMCR The pact mock service is used for contract testing. When you are making or verifying a contract, you don't care how many times a particular request is made, you're just checking the contents of the requests.

If you want a test that checks the number of times a call is made, then I'd recommend using a different framework for that particular test. Its concerns are different from a contract test, and you should use the right tool for the right problem.