获取 fastlane 在 iOS 上打印测试用例错误?

问题描述 投票:0回答:1

在一个简单的项目中,当在我的系统上本地运行单元测试通道时,fastlane 不会报告任何错误,尽管测试用例具有如下所示的失败测试方法:

import XCTest
@testable import CICDDemo

final class CICDDemoTests: XCTestCase {

    func testFailure() {
        XCTAssertTrue(1==2)
    }
}

我的快速文件设置如下,然后我在终端中运行

fastlane unit_tests

default_platform(:ios)

platform :ios do
  desc "Description of what the lane does"
  lane :custom_lane do
    # add actions here: https://docs.fastlane.tools/actions
  end

  # Unit tests lane
  lane :unit_tests do
    run_tests(build_for_testing: true,
              scheme: "CICDDemo",
              only_testing: "CICDDemo",
              device: "iPhone 14")
  end
end

fastlane 输出显示如下:

[11:28:07]: ▸ Processing empty-CICDDemo.plist
[11:28:08]: ▸ Linking CICDDemo
[11:28:10]: ▸ Processing empty-CICDDemoTests.plist
[11:28:10]: ▸ Linking CICDDemoTests
[11:28:11]: ▸ Processing empty-CICDDemoUITests.plist
[11:28:12]: ▸ Linking CICDDemoUITests
[11:28:12]: ▸ Test build Succeeded

+---------------------------------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
| 2    | run_tests        | 31          |
+------+------------------+-------------+

[11:28:13]: fastlane.tools finished successfully 🎉

我的目标是让 fastlane 打印正在测试的文件名和方法以及成功或错误(如果有)。我需要使用scan吗?

ios swift fastlane
1个回答
0
投票

对于任何偶然发现此问题的人来说,问题在于配置设置

build_for_testing
。根据文档

删除它解决了问题。

© www.soinside.com 2019 - 2024. All rights reserved.