Hi doing some preliminary research regarding contract testing using PACT. In the paradigm in which I am using a pact broker to host the pacts, I understand from a high level that there needs to be a contract test on the consumer side which runs a set of tests against the pact mock server...which would then be published to the pact broker. The provider would also need a contract in which it uses the pact created by the consumer on the pact broker to run its test.
My question is this: On the consumer side, is there a need to write multiple different tests for each endpoint?
The short answer is yes.
It depends on what each of the API endpoints do. But usually, each endpoint could handle different operations, and depending on the request you would want to make sure your code can handle it (if it uses all of these operations - which is important).
e.g. the following is fairly typical for a "CRUD"-like service:
/<resource>
with valid request, return 200
and a resource body/<resource>
with a bad request, return a 400
and an error body/<resource>
without an authentication token, return a 401
/<resource>
with a valid request, return 201
and a resource id / body/<resource>
... and so onWithin each operation and resource, there may be polymorphic payloads (requests or response). If your consumer code has to deal with this, it should have tests for those also.
You might find this page in our docs useful on this topic.