Любая помощь будет принята с благодарностью. Я несколько недель боролся за то, чтобы мои модульные тесты работали как часть моего конвейера сборки с Дженкинсом и Фастлэйном.
Когда я запускаю их через Фастлэйн локально, все в порядке. Я запускаю fastlane unit_tests
и все компилируется, запускается симулятор и запускаются тесты.
Когда я запускаю их на конвейере сборки, после запуска симулятора и запуска первого теста я вижу ошибку.
Я не понимаю, чего здесь не хватает. Я бы подумал, что сборки разработки, которую fastlane создает с опцией scan
, будет достаточно, чтобы включить все необходимое для запуска тестов. Определение полосы движения:
desc "Run Unit Tests"
lane :unit_tests do
scan(
scheme: "myAppTests",
devices: ["iPhone 11"]
)
end
Я получаю ошибку:
[16:20:32]: ▸ Linking myAppTests
[16:20:33]: ▸ Copying provisioning.plist
[16:20:33]: ▸ Copying GoogleService-Info.plist
[16:20:33]: ▸ Compiling SynchronizationViewController.xib
[16:20:33]: ▸ Processing Info.plist
[16:20:33]: ▸ Running script '[CP] Embed Pods Frameworks'
[16:20:33]: Running Tests: ▸ Touching myAppTests.xctest (in target 'myAppTests' from project 'myApp')
[16:20:33]: ▸ Build Succeeded
[16:20:34]: ▸ Linking MYAPP
[16:20:34]: ▸ Running script 'SwiftLint'
[16:20:35]: ▸ Linking myAppTests
[16:20:35]: ▸ 2020-02-20 16:20:35.801 xcodebuild[42315:2308394] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
[16:20:35]: ▸ /Users/Jenkins.SVN/Library/Developer/Xcode/DerivedData/MYAPP-gjylxkutiwwowsdxuadsovduecib/Logs/Test/Run-myAppTests-2020.02.20_16-19-59-+0000.xcresult/Staging/2_Test/Diagnostics/myAppTests-35F843CE-22FC-427A-B385-A9EF0F61E4B1/myAppTests-D3C6D752-F909-4965-BAB5-26194C7BB5D0/Session-myAppTests-2020-02-20_162035-s3sDH8.log
[16:20:35]: ▸ 2020-02-20 16:20:35.801 xcodebuild[42315:2306273] [MT] IDETestOperationsObserverDebug: (5D31D2AA-6061-40B3-943F-858AE0181E65) Beginning test session myAppTests-5D31D2AA-6061-40B3-943F-858AE0181E65 at 2020-02-20 16:20:35.801 with Xcode 11C505 on target <DVTiPhoneSimulator: 0x7fa3f1a8e220> {
[16:20:35]: ▸ SimDevice: iPhone 11 (703948B3-684D-4E84-AFD4-34FFB522203D, iOS 13.3, Shutdown)
[16:20:35]: ▸ } (13.3 (17C45))
[16:20:37]: ▸ 2020-02-20 16:20:37.747 xcodebuild[42315:2306273] [MT] IDETestOperationsObserverDebug: (5D31D2AA-6061-40B3-943F-858AE0181E65) Finished requesting crash reports. Continuing with testing.
[16:20:40]: ▸ 2020-02-20 16:20:40.907 xcodebuild[42315:2306273] [MT] IDETestOperationsObserverDebug: 5.110 elapsed -- Testing started completed.
[16:20:40]: ▸ 2020-02-20 16:20:40.907 xcodebuild[42315:2306273] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
[16:20:40]: ▸ 2020-02-20 16:20:40.907 xcodebuild[42315:2306273] [MT] IDETestOperationsObserverDebug: 5.110 sec, +5.110 sec -- end
[16:20:41]: ▸ Testing failed:
[16:20:41]: ▸ myAppTests:
[16:20:41]: ▸ xctest (43228) encountered an error (Failed to load the test bundle. (Underlying error: The bundle “myAppTests” couldn’t be loaded because it is damaged or missing necessary resources. The bundle is damaged or missing necessary resources. dlopen_preflight(/Users/Jenkins.SVN/Library/Developer/Xcode/DerivedData/MYAPP-gjylxkutiwwowsdxuadsovduecib/Build/Products/Debug-iphonesimulator/myAppTests.xctest/myAppTests): Library not loaded: @rpath/libswiftCore.dylib
[16:20:41]: ▸ Referenced from: /Applications/Xcode-11.3.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib/libXCTestSwiftSupport.dylib
[16:20:41]: ▸ Reason: Incompatible library version: libXCTestSwiftSupport.dylib requires version 1.0.0 or later, but libswiftCore.dylib provides version 0.0.0))
[16:20:41]: ▸ ** TEST FAILED **
Подфайл:
# define a global platform for your project
platform :ios, '13.2'
# ignore all warnings from all pods
inhibit_all_warnings!
def default_pods
pod 'MyAwesomePod'
end
target 'myApp' do
use_frameworks!
default_pods
end
target 'myAppTests' do
inherit! :search_paths
use_frameworks!
default_pods
end
target 'myAppUITests' do
inherit! :search_paths
use_frameworks!
default_pods
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'NO'
config.build_settings['SWIFT_EXEC'] = '$(SRCROOT)/SWIFT_EXEC-no-coverage'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf-with-dsym'
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES'
end
end
end
Always Embed Swift Standard Libraries
установлен на YES
через цель теста и цель приложения.