Skip to content
An example macOS app demonstrating the use of PactConsumerSwift (https://github.com/DiUS/pact-consumer-swift) framework using Carthage.
Swift Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
PactMacOSExample.xcodeproj
PactMacOSExample
PactMacOSExampleTests
images
tmp/pacts
.gitignore
.travis.yml
Cartfile
Cartfile.resolved
Gemfile
README.md

README.md

PactMacOSExample

Build Status Carthage compatible Swift

An example macOS app demonstrating the use of PactConsumerSwift (https://github.com/DiUS/pact-consumer-swift) framework using Carthage.

Requirements

  • Xcode 10 and Swift 4
  • Carthage brew install carthage
  • Download pact-ruby-standalone (in this particular example project the binaries were moved to $PROJ_DIR/tmp/pact/bin where scheme test pre-actions and post-actions add the path to $PATH)

Workflow

  • Create your MacOS app.
  • Run carthage update --platform macOS
  • Link your dependencies to your project targets and copy-frameworks in an additional Build Step for each of your targets - you know, the Carthage stuff...
  • Add exception to allow http calls to localhost by editing your info.plist:
    Info.plist allow access to/from http
  • 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 xcodebuild).
  • Grab your ./tmp/pacts/_your_provider-your_client.json pact file to share with developers working on the API provider or submit to a Pact Broker.
  • Celebrate 🎉
You can’t perform that action at this time.