4

I am trying to publish the verification results to pact broker with pact for jvm/spring. I am using junit4. The test is executed and passed, A verification report is printed to console/ json file is added, but it's not publishing the results to pact broker.

In pom.xml:

<dependency>
    <groupId>au.com.dius</groupId>
    <artifactId>pact-jvm-provider-spring_2.12</artifactId>
    <version>3.5.24</version>
</dependency>

In TestContract.class:

@RunWith(SpringRestPactRunner.class)
@Provider("prov_test")
@PactBroker(host="192.168.132.220",port="80")
@VerificationReports({"console", "json"})
@SpringBootTest(
    properties={
        "pact.provider.version=1.0.1",
        "pact.verifier.publishResults=true"
    },
    webEnvironment = SpringBootTest.webEnvironment.DEFINED_PORT
)
public class TestContract {
...
...
}

In the output I get the warnning:

Skipping publishing of verification results (pact.verifier.publishResults is not set to 'true')

Thanks for your help!

yoka791
  • 576
  • 5
  • 17

2 Answers2

3

We're junit5 and had to set it in the @BeforeEach to get it to work :

    void setupTestTarget(PactVerificationContext context) {
        context.setTarget(new HttpTestTarget("localhost", port, "/"));
        System.setProperty("pact.verifier.publishResults", "true");
        System.setProperty("pact.provider.version", buildVersion);
    }
1

Change pact.verifier.publishResults=true to pact.verifier.publishResults='true'

See this github thread

Alien
  • 15,141
  • 6
  • 37
  • 57
  • 1
    changed to `"pact.verifier.publishResults='true'"` but still not working. I also still get the warning "Skipping publishing of verification results (pact.verifier.publishResults is not set to 'true'".. – yoka791 Nov 28 '18 at 06:10