Reputation: 3568
I am trying to add UI Tests to my project using EarlGrey 2.0 by following this steps to install the framework : https://www.youtube.com/watch?v=KQaA11qVQn0 (using Cocoapods). It build successfully but when I tried to run the test, I got this error:
2020-11-27 14:18:16.076586+0700 X-UITests-Runner[75526:5465621] The bundle X-UITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2020-11-27 14:18:16.076704+0700 X-UITests-Runner[75526:5465621] (dlopen_preflight(/X-blqsydhdzeecqndvwzwsshajcwdm/Build/Products/Debug-iphonesimulator/X-UITests-Runner.app/PlugIns/X-UITests.xctest/X-UITests): Library not loaded: @rpath/Alamofire.framework/Alamofire
Referenced from: /X-blqsydhdzeecqndvwzwsshajcwdm/Build/Products/Debug-iphonesimulator/X-UITests-Runner.app/PlugIns/X-UITests.xctest/X-UITests
Reason: image not found)
I have this on my podfile:
use_frameworks!
def shared_pods
pod 'Alamofire'
pod 'Firebase'
pod 'Firebase/Analytics'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Crashlytics'
pod 'Firebase/Messaging'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Introspect'
pod 'ReachabilitySwift'
pod 'RealmSwift'
pod 'SDWebImageSwiftUI'
pod 'SwiftKeychainWrapper'
pod 'Zip'
end
target 'X' do
shared_pods
pod 'EarlGreyApp'
end
target 'X-UITests' do
inherit! :search_paths
pod 'EarlGreyTest'
pod 'eDistantObject', '0.9.0'
end
I have tried to uncheck the Find Implicit Dependencies
on the scheme, but still got the error. Any help? Thanks.
Upvotes: 2
Views: 323
Reputation: 401
This kind of error, in general, says that some class which are you trying to test has dependency to Alamofire pod. So you have to add Alamofire also to your test Target
target 'X-UITests' do
...
pod 'Alamofire'
...
end
Upvotes: 0
Reputation: 151
Try using use_frameworks! next to target,
def shared_pods
pod 'Alamofire'
pod 'Firebase'
pod 'Firebase/Analytics'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Crashlytics'
pod 'Firebase/Messaging'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Introspect'
pod 'ReachabilitySwift'
pod 'RealmSwift'
pod 'SDWebImageSwiftUI'
pod 'SwiftKeychainWrapper'
pod 'Zip'
end
target 'X' do
use_frameworks!
shared_pods
pod 'EarlGreyApp'
end
target 'X-UITests' do
use_frameworks!
inherit! :search_paths
pod 'EarlGreyTest'
pod 'eDistantObject', '0.9.0'
end
Upvotes: 0