This codebase provides the mock service used by implementations of Pact. It is packaged as a gem, and as a standalone executable for Mac OSX and Linux (Windows coming soon.)
The mock service provides the following endpoints:
- DELETE /interactions - clear previously mocked interactions
- POST /interactions - set up an expected interaction
- GET /interactions/verification - determine whether the expected interactions have taken place
- POST /pact - write the pact file
As the Pact mock service can be used as a standalone executable and administered via HTTP, it can be used for testing with any language. All that is required is a library in the native language to create the HTTP calls listed above. Currently there are binding for Ruby and Javascript. If you are interested in creating bindings in a new langauge, and have a chat to one of us on the pact-dev Google group.
$ gem install pact-mock_service
$ pact-mock-service --port 1234
Run pact-mock-service help
for command line options.
Check out the wiki page here.
If you need to use the mock service with HTTPS, you can use the built-in SSL mode which relies on a self-signed certificate.
$ pact-mock-service --port 1234 --ssl
See the releases page for the latest standalone executables.
I had a package somewhere lying around, but I lost it, and I don't have a Windows machine. If you are interested in using the mock server on Windows, please check out the instructions for building one here, and then let me know so I can upload it to the releases page. Thanks!
See CONTRIBUTING.md