javajunitdatacontractpactpact-java

Use Pact and JUnit to test SSL secured API


I am trying to implement pact tests between two of our server systems, but unfortunately I am struggling with implementing the consumer tests: I included the pact-jvm-consumer-junit_2.11 artifact and created a provided like this using a @Rule:

@Rule
public PactProviderRule mockProvider = new PactProviderRule("test_provider", "localhost", PORT, this);

Unfortunately (for the tests at least) our client is hardcoded to use a SSL connection. Therefore our tests fail because the pact server does not allow SSL connections. Is there a way to tell pact to do so or work around this without the need for setting up a external reverse proxy server?


Solution

  • Turns out it wasn't really supported yet. I created a feature request, which was already implemented: https://github.com/DiUS/pact-jvm/issues/241