I've specified the example keys and values in the run scheme's environment variables, run the tests in record mode and then with record mode off.
Still, I'm getting the error "/Users/xqc/Library/Mobile Documents/comappleCloudDocs/Xcode Projects & Resources/Snapshot/SnapshotTests/SettingsVCSnapshotTests.swift:26: error: -[SnapshotTests.SettingsVCSnapshotTests test_example] : failed - Snapshot comparison failed: Optional(Error Domain=FBSnapshotTestControllerErrorDomain Code=1 "Unable to load reference image." UserInfo={NSLocalizedFailureReason=Reference image not found. You need to run the test in record mode, NSLocalizedDescription=Unable to load reference image., FBReferenceImageFilePathKey=/Users/xqc/Library/Developer/CoreSimulator/Devices/A5B479B7-4DF1-B030-05CAF050B00C/data/Containers/Bundle/Application/629A7F7C-4264-B830/Snapshot.app/PlugIns/SnapshotTests.xctest/ReferenceImages_64/SnapshotTests.SettingsVCSnapshotTests/[email protected]})"
import iOSSnapshotTestCase
@testable import Snapshot
final class SettingsVCSnapshotTests: FBSnapshotTestCase {
private var sut: SettingsVC!
override func setUp() {
super.setUp()
recordMode = false
sut = SettingsVC()
}
override func tearDown() {
sut = nil
super.tearDown()
}
func test_example() {
FBSnapshotVerifyViewController(sut)
}
}
What can I do to figure out the problem?
Thanks
This solved it: https://github.com/uber/ios-snapshot-test-case/issues/191
When using test plans, the environment variables should be set from the test plan configuration.