mavenmicroservicespactpact-java

PACT: java-maven


I need few answer for my doubt:

  1. Pact-mock-service Vs pact-jvm-server, is both are same? Pls describe this.
  2. Am implementing the PACT in java-maven

I can able to run this:

https://github.com/anha1/microservices-pact-maven

https://github.com/warmuuh/pactbroker-maven-plugin

Help me to understand this with pact-mock-service and pact-jvm-server


Solution

  • Pact-mock-service is a general mock server built into the pact libraries to support mocking out the other dependency in an integration during a consumer test. If you use any of the consumer test support libraries, you do not need to use it directly.

    pact-jvm-server is a controllable server that bundles the Pact-mock-service and allows you to setup and tear down mock servers via HTTP requests. It exists for people who can not,or do not wish to use the consumer test support libraries.

    For people using Maven, there is a plugin provided as part of the pact-jvm project that can do provider verification tests and publish to a pact broker. For the consumer tests, they just run as JUnit tests so you don't need any Maven specific plugin.

    Of the two links you posted, the first is an example project using a spring-boot application, and the second is a maven plugin that provides publishing to a pact broker only.