An example macOS app demonstrating the use of PactConsumerSwift (https://github.com/DiUS/pact-consumer-swift) framework using Carthage.
- Xcode 10 and Swift 4
brew install carthage
- Download pact-ruby-standalone (in this particular example project the binaries were moved to
$PROJ_DIR/tmp/pact/binwhere scheme test pre-actions and post-actions add the path to
- Create your MacOS app.
carthage update --platform macOS
- Link your dependencies to your project targets and
copy-frameworksin an additional Build Step for each of your targets - you know, the Carthage stuff...
- Add exception to allow http calls to
localhostby editing your
- Add your source code and write your tests.
- Update your scheme's Test stage pre- and post-action by adding a script to start and stop your pact mock service. How?
- Run your tests in Xcode (or
- Grab your
./tmp/pacts/_your_provider-your_client.jsonpact file to share with developers working on the API provider or submit to a Pact Broker.