为什么fastlane似乎也运行UITests目标,尽管fastfile只指定了单元测试目标?

only_testing: 'CICDDemoTests',

这就是我在日志(log)中看到的,工作流似乎在这里花费了相当多的时间:

[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上以类似的日志(log)在本地运行bundle exec fastlane scan时,我看到了同样的行为.Github Actions工作流程日志(log)要点如下:

[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时,它似乎忽略了fast文件,并运行包括单元和用户界面测试在内的整个测试套件.如果运行lane,而不是通过bundle exec fastlane unit_tests,它确实会忽略UITest.

[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 |
+--------------------+---+

Ios相关问答推荐

如何从ipad获取用户定义的设备名称,IOS版本应大于16在flutter

preferredCompactColumn作为NavigationSplitViewColumn.sidebar传递,但仍能在iOS上看到详细信息页面

如何访问iOS模拟器中的zoom 设置?(在搜索中列出,但不可见)

在flatter_riverpod中,如果没有ref对象,我们如何访问提供程序?

为什么下面的代码没有在主线程上运行?

当 .searchable 修饰符处于活动状态时,如何将变量设置为 false?

@MainActor 类的扩展是主要演员吗?

为 ColorPicker 创建一个名为 Color 的计算变量的绑定

转换在 NavigationView 中不起作用

在所有 tableview / collectionview 中禁用滚动指示器

.overlay 和 body 是什么 swift 概念

如何从 scendelegate 打开我的标签栏控制器

如何 comments .plist 文件中的行?

滑动列表项以获取更多选项(Flutter)

以编程方式获取故事板 ID?

标题为 UIImage 的导航栏

Xcode 8:函数类型不能有参数标签 destruct 我的构建

用户拒绝使用后如何提示用户打开位置服务

使用 xib 创建可重用的 UIView(并从情节提要中加载)

UIGestureRecognizer 阻止子视图处理touch 事件