You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alternatively you can download and install the [pact-ruby-standalone][pact-ruby-standalone-releases] archives for your platform and install as per installation instructions written in [Pact Ruby Standalone release notes][pact-mock-service-standalone-installation].
Add the Pod
Add to your Test target in your Podfile
target 'MyProjectTests' do
pod 'PactConsumerSwift'
end
Setup your Test Target to run the pact server before the tests are run
Modify the Test Target's scheme to add scripts to start and stop the pact server when tests are run.
From the menu Product -> Scheme -> Edit Scheme
Under Test, Pre-actions add a Run Script Action
Add a Run Script Action with the following
NB: the PATH variable should be set to the location of the pact-mock-service binary - you can find the path using which pact-mock-service
Make sure you select your project under Provide the build settings from, otherwise SRCROOT will not be set which the scripts depend on
Objective-C Caveat: Your Test Target Must Include At Least One Swift File
The Swift stdlib will not be linked into your test target, and thus
PactConsumerSwift will fail to execute properly, if you test target does not contain
at least one Swift file. If it does not, your tests will exit
prematurely with the following error:
*** Test session exited(82) without checking in. Executable cannot be
loaded for some other reason, such as a problem with a library it
depends on or a code signature/entitlements mismatch.
To fix the problem, add a blank file called BlankClass.swift to your test target:
// BlankClass.swift
import PactConsumerSwift
Writing tests
See PactTests.m for examples of writing Pact tests in Objective C. For Swift see Pact Swift Example