A command line tool to convert Pact files to Postman collections.
Requires NodeJS version v20.11
or higher.
npm install -g pmpact
Clone the repo and from the root execute:
npm install
npm link
Note: Don't forget to run npm unlink
if needed!
pmpact http://pact-broker/provider/a-provider/consumer/a-consumer/latest
pmpact pact-file.json
pmpact http://pact-broker/provider/a-provider/consumer/a-consumer/latest -o postman-collection.json
pmpact http://pact-broker/provider/a-provider/consumer/a-consumer/latest -H '{"Authorization":"Basic ZFhmbHR5Rk1n..."}'
Once you have a generated Postman collection, select "import" in Postman. The generated collection format is 2.1
.
A collection should appear, starting with the name "Pact".
A url variable is used for all the requests. The next step is to create an Postman environment with a url variable, for example: url: http://my-service.com
.
You're good to go - so make the requests!
npm test
npm run test-unit
npm run test-integration
### Watch tests
npm install -g nodemon
nodemon tests/unit -x "npm run test-unit"
nodemon tests/integration -x "npm run test-integration"
When contributing, the process we adhere to for releases is found in RELEASE.md.