Skip to content

Simple playground app for pact-python contract testing. Including both messaging and REST

License

Notifications You must be signed in to change notification settings

jorzel/contract-testing

Repository files navigation

Simple playground app for pact-python contract testing.

  1. Run pact broker:
>> docker-compose up
  1. Go into postgres container and create pact user role:
CREATE USER pactbrokeruser WITH PASSWORD 'pactbrokeruser';
CREATE DATABASE pactbroker WITH OWNER pactbrokeruser;
GRANT ALL PRIVILEGES ON DATABASE pactbroker TO pactbrokeruser;
  1. Now you can enter http://myuser:mypassword@localhost to see pact admin page.

  2. In consumer location run with unique consumer version_num:

>> pytest --publish-pact <version_num>

In these step pact file will be generated and send to broker. Our consumer would be tested against mocked service.

  1. In provider location run with unique provider version_num:
>> pytest --publish-version <version_num>:

It would verify our provider against latest pact stored within broker.

  1. Checking whether can deploy component (provider / consumer):
http://localhost/can-i-deploy?pacticipant=<provider>&version=<version_num>

Releases

No releases published

Packages

No packages published