This demo shows, how PACT can be used to assert the contract (REST API) between a client and a service. PACT is client driven, i.e. the client specifies the expected behaviour and generates a according JSON file. This is usually done by writing tests incl. according generation of the file. The corresponding service then can be automatically verified against this pact file. In order to make these pact files accessible they are uploaded to and pulled from a "pact broker".
- start the broker
- docker and docker-compose is needed
cd pact-broker && sudo docker-compose up
- web UI under
localhost:80
- generate pact file via junit test
cd consumer && mvn clean install -DskipTests=false
- this will generate a pact JSON file in
consumer/target/pacts
- upload generated pact file to broker
cd consumer && mvn pact:publish
- verify pact against producer
cd producer && mvn clean install -DskipTests=false
- have a look at
http://localhost:80
- overview of pacts
- differences between different version of 1 pact
- overview of relations of services via a graph
-
general info
-
consumer side
- lib for client testing (and annotations): https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-consumer-junit
-
producer side
- lib for producer verifications (and annotations): https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-junit
-
broker
-
maven plugin for consumer and producer (upload of files to broker and download for verification)