We are using PACT library for contract testing. Current project relies on junit5 integration. I have to extend one test to use 2 providers instead of 1:
Current version:
@Test
@PactTestFor(providerName = "request-repository", hostInterface = "0.0.0.0", port = "9991")
public void myTestMethod() throws Exception {}
I read doc: https://docs.pact.io/implementation_guides/jvm/consumer/junit5 and it seems to be not supported yet:
Unsupported#
The current implementation does not support tests with multiple providers. This will be added in a later release.
I checked the release notes and I haven't found any updates. Is there another way how to define another provider? ie something as:
@Test
@PactTestFor(providerName = "request-repository", hostInterface = "0.0.0.0", port = "9991")
@PactTestFor(providerName = "result-repository", hostInterface = "0.0.0.0", port = "9992")
public void myTestMethod() throws Exception {}
Or in this case junit5 integration is not a good choice?
My suggestion would be to write 2 separate tests, where each test has one provider mocked via Pact and the other provider stubbed out (e.g. with a standard unit test stub).