为什么 fastlane 似乎也运行 UITests 目标,尽管 fastfile 仅指定单元测试目标?
only_testing: 'CICDDemoTests',
这是我在日志中看到的内容,工作流程似乎在这里花费了大量时间:
[05:37:36]: ▸ Running Tests: [CICDDemoUITests] Touching CICDDemoUITests.xctest
[05:57:22]: ▸ CICDDemoUITests-Runner (9096) encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying Error: Test crashed with signal kill before starting test execution.))
在我的 Mac 上本地运行
bundle exec fastlane scan
时,我看到相同的行为并具有类似的日志。 Github 操作工作流程日志要点如下:
[05:37:30]: ▸ [CICDDemo] Processing empty-CICDDemo.plist
[05:37:31]: ▸ Signing CICDDemo.app (in target 'CICDDemo' from project 'CICDDemo')
[05:37:31]: ▸ Running Tests: [CICDDemo] Touching CICDDemo.app
[05:37:31]: ▸ Build Succeeded
[05:37:31]: ▸ [CICDDemo] Processing empty-CICDDemo.plist
[05:37:36]: ▸ [CICDDemoTests] Processing empty-CICDDemoTests.plist
[05:37:36]: ▸ Signing CICDDemoTests.xctest (in target 'CICDDemoTests' from project 'CICDDemo')
[05:37:36]: ▸ Running Tests: [CICDDemoTests] Touching CICDDemoTests.xctest
[05:37:36]: ▸ Signing CICDDemo.app (in target 'CICDDemo' from project 'CICDDemo')
[05:37:36]: ▸ [CICDDemoUITests] Processing empty-CICDDemoUITests.plist
[05:37:36]: ▸ [CICDDemoUITests] Copying Info.plist
[05:37:36]: ▸ Signing CICDDemoUITests.xctest (in target 'CICDDemoUITests' from project 'CICDDemo')
[05:37:36]: ▸ Signing CICDDemoUITests-Runner.app (in target 'CICDDemoUITests' from project 'CICDDemo')
[05:37:36]: ▸ Running Tests: [CICDDemoUITests] Touching CICDDemoUITests.xctest
[05:57:22]: ▸ Testing failed:
[05:57:22]: ▸ CICDDemoUITests-Runner (9096) encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying Error: Test crashed with signal kill before starting test execution.))
[05:57:22]: ▸ Failing tests:
[05:57:22]: ▸ CICDDemoTests.testOperation()
[05:57:22]: ▸ ** TEST FAILED **
我的快速文件内容:
platform :ios do
# Lane configuration
lane :unit_tests do
scan(
project: 'CICDDemo',
scheme: 'CICDDemo',
configuration: 'Debug',
only_testing: 'CICDDemoTests',
devices: devices,
prelaunch_simulator: true,
clean: true,
skip_build: true,
xcodebuild_formatter: 'xcbeautify -qq --is-ci --renderer github-actions',
code_coverage: true,
output_types: 'junit'
)
end
end
因此,在运行
bundle exec fastlane scan
时,它似乎会忽略 fastfile 并运行整个测试套件,包括单元和 UI 测试。如果通过 lane
运行 bundle exec fastlane unit_tests
,它会忽略 UITests。
[10:29:46]: ▸ Loading...
[10:29:47]: ▸ 2023-10-25 10:29:47.143 xcodebuild[25203:305328] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
[10:29:48]: ▸ Signing UnitTestingDemo.app (in target 'UnitTestingDemo' from project 'UnitTestingDemo')
[10:29:48]: ▸ Build Succeeded
[10:29:50]: ▸ [UnitTestingDemo] Processing empty-UnitTestingDemo.plist
[10:29:51]: ▸ [UnitTestingDemoTests] Processing empty-UnitTestingDemoTests.plist
[10:29:51]: ▸ Signing UnitTestingDemoTests.xctest (in target 'UnitTestingDemoTests' from project 'UnitTestingDemo')
[10:29:51]: ▸ Signing UnitTestingDemo.app (in target 'UnitTestingDemo' from project 'UnitTestingDemo')
[10:29:51]: ▸ [UnitTestingDemoUITests] Processing empty-UnitTestingDemoUITests.plist
[10:29:52]: ▸ Signing UnitTestingDemoUITests.xctest (in target 'UnitTestingDemoUITests' from project 'UnitTestingDemo')
[10:30:31]: ▸ Test Suite UnitTestingDemoTests started on 'Clone 1 of iPhone SE (3rd generation) - UnitTestingDemo (25470)'
[10:30:31]: ▸ ✔ testExample on 'Clone 1 of iPhone SE (3rd generation) - UnitTestingDemo (25470)' (0.003 seconds)
[10:30:31]: ▸ ✔ testPerformanceExample on 'Clone 1 of iPhone SE (3rd generation) - UnitTestingDemo (25470)' (0.351 seconds)
[10:30:31]: ▸ 2023-10-25 10:30:31.895 xcodebuild[25203:305328] [MT] IDETestOperationsObserverDebug: 39.770 elapsed -- Testing started completed.
[10:30:31]: ▸ 2023-10-25 10:30:31.896 xcodebuild[25203:305328] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
[10:30:31]: ▸ 2023-10-25 10:30:31.896 xcodebuild[25203:305328] [MT] IDETestOperationsObserverDebug: 39.770 sec, +39.770 sec -- end
[10:30:32]: ▸ Test Succeeded
[10:30:35]: Skipping HTML... only available with `xcodebuild_formatter: 'xcpretty'` right now
[10:30:35]: Your 'xcodebuild_formatter' doesn't support these 'output_types'. Change your 'output_types' to prevent these warnings from showing...
+------------------------+
| Test Results |
+--------------------+---+
| Number of tests | 2 |
| Number of failures | 0 |
+--------------------+---+