I am trying to run some XCTest. I am not very familiar with it already. I imported my main module to test some classes. I had to open xcworkspace, instead of xcodeproj and then it compiled.
However, I am still running into an issue. I am using CocoaPods on macOS to add Sparkle, and AppCenter to the App. It works fine in the main application, however when I run my test it crashes with the following message:
dyld: warning: could not load inserted library '/Users//Library/Developer/Xcode/DerivedData/.../Frameworks/libXCTestBundleInject.dylib' into hardened process because no suitable image found.
dyld: Library not loaded: @rpath/Sparkle.framework/Versions/A/Sparkle
I tried to import these frameworks, which didn't work either. Am I doing something wrong or missing something maybe in the Build Settings?
I also tried adding them in the Podfile, which didn't work either.
That's my Test class:
@testable import MyApplication
import XCTest
class MoneyTest: XCTestCase {
var moneyEUR1 : Money!
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
self.moneyEUR1 = Money(number: 1200, currency: "EUR")
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
self.moneyEUR1 = nil
}
My Podfile:
target 'MyApplication' do
# Comment the next line if you don't want to use dynamic frameworks
#use_frameworks!
# Pods for MyApplication
pod 'AppCenter'
pod 'Sparkle'
target 'MyApplication Tests' do
inherit! :search_paths
# Pods for testing
# here I tried to add the pod aswell, which didn't work
# it should actually inherit? shouldn't it?
end
end
I don't know where I have to add my Pods framework to the Test Target.