Hi All, I have a provider state question. I'm tes...
# pact-jvm
e
Hi All, I have a provider state question. I'm testing a Java Provider and using
mvn pact:verify
for the Consumer contracts. I supply Provider mocks via Microcks (a mock server) loaded with mocks from OpenAPI Examples that are lint validated with Spectral. Because the OpenAPI schema and the Java Provider endpoint as always in sync I feel confident my mocks will not go out of sync with the Provider endpoint. However I do worry about the Provider response after any business logic might be executed (State). At present I'm considering using Microcks's response behaviour features Dispatcher Rules to inject Provider State, but feel this can go out of sync with the real Provider. I see you can use Pact Junit runner to inject Provider states as well, but I don't see how this will also stop the endpoint's business logic going out of the sync. Any advice appreciated! Thanks.
u
If the business logic was out of sync, would the tests not fail?
e
I was hoping to keep my mock responses in a Mock Server, and use maven PACT verify, but there does not seem to be a way to make sure the Mock Server's dispatcher rules and the Producer's business logic stay in sync, as the server has no access to run tests against the Producer. It just responds to maven pact:verify's requests. PACT JUnit runner can call Producer business logic in the Unit test to process Mocks responses while verifying the PACT, but I loose the usefulness of a Mock Server to keeping responses for multiple teams to use. I'll end up creating two sets of Mocks: those in the Unit tests, and those in the Mock Server. It would be nice to have Mocks that are verified in one place, and accessible by all.