This repository aims to exemplify, in a simple and practical way, the execution of contract tests with Pact using different languages for each application.
The flow used is as simple as possible to carry out the communication of the provider and consumer tests. It is far from ideal for use in software productions! If you want a complete flow for your application, I recommend Nirvana for contract test which makes use of CI for verification steps.
The Pact Broker is responsible for the communication between the systems, ensuring the execution of the tests On both sides. Thus, the consumer sends the contract containing the information he expects to receive on a given route. and the provider downloads this contract, executes it locally, checking if the data is being sent as expected and returns test results for the Pact Broker.
docker-compose up
O consumer it is the application that consumes the API, it is responsible for making data requests to the provider.
- Docker
make build
make run-it
npm run test:consumer
npm run pact:publish
The provider is the application that promotes the API, is responsible for sending the data requested by the consumer.
- PHP
- composer
php -S localhost:8000
vendor/bin/phpunit