在一个简单的项目中,当在我的系统上本地运行单元测试通道时,fastlane不会报告任何错误,尽管测试用例有一个失败的测试方法,比如:
import XCTest
@testable import CICDDemo
final class CICDDemoTests: XCTestCase {
func testFailure() {
XCTAssertTrue(1==2)
}
}
我的fastfile设置如下,然后在终端中运行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吗?
1条答案
按热度按时间hjzp0vay1#
对于任何偶然发现这一点的人来说,问题在于配置设置
build_for_testing
。根据documentation,删除它解决了这个问题。