Here we have an example describing Pact tests between a consumer (the Billing Service and the User Frontend) and its provider (the User Service).
-
First of all, you need to start Pact Broker
cd devops && docker-compose up
-
Secondly, generate and publish the Billing Service pact consumer contracts to the pact broker
mvn clean verify -f billing-service
-
Then, generate and publish the User Frontend pact consumer contracts to the pact broker
cd user-frontend
npm run pact:test && npm run pact:publish
-
Finally, we need to verify those contracts generated by consumer with provider i.e. User Service
mvn clean verify -f user-service
To to see pact contracts live documentation: http://localhost:7080/