gpt4 book ai didi

ios - 测试在 Xcode 中通过但在 Circle CI 中失败

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:57:56 24 4
gpt4 key购买 nike

问题 this pull request , 测试没有通过 CircleCI 但测试在本地通过。为什么?


CircleCI test output显示所有 FBSnapshotTestCase 测试失败。例如:

✗ testAdjustsFontSizeToFitWidth, ((comparisonSuccess__) is true) failed - Snapshot comparison failed: Error Domain=FBSnapshotTestControllerErrorDomain Code=1 "Unable to load reference image." UserInfo=0x7f85f36b0a50 {NSLocalizedFailureReason=Reference image not found. You need to run the test in record mode, NSLocalizedDescription=Unable to load reference image., FBReferenceImageFilePathKey=/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/testAdjustsFontSizeToFitWidth@2x.png}

[…]

✗ testAttributedTruncationToken, ((comparisonSuccess__) is true) failed - Snapshot comparison failed: Error Domain=FBSnapshotTestControllerErrorDomain Code=1 "Unable to load reference image." UserInfo=0x7f85f35b06d0 {NSLocalizedFailureReason=Reference image not found. You need to run the test in record mode, NSLocalizedDescription=Unable to load reference image., FBReferenceImageFilePathKey=/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/testAttributedTruncationToken@2x.png}

但是,相同的测试在本地通过:

image

在 CircleCI 上,测试使用 ReferenceImages_32 目录,该目录不存在:

/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/testAdjustsFontSizeToFitWidth@2x.png

但是,图像确实存在于 ReferenceImages_64 中。我希望使用 _64 目录,因为 circle.yml 文件指定使用 iPhone 6 模拟器:

dependencies:
pre:
- xcrun instruments -w "iPhone 6 (8.3 Simulator)" || exit 0
override:
- sudo gem install cocoapods xcpretty obcd -N
- pod install --project-directory=Example
test:
override:
- set -o pipefail && xcodebuild -workspace 'Example/Espressos.xcworkspace' -scheme 'Espressos'
-sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 6"
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES clean test | xcpretty -c
--report junit --output ${CIRCLE_TEST_REPORTS}/junit.xml

最佳答案

您是否尝试过在没有缓存的情况下运行构建?这经常为我解决这些问题。要在没有缓存的情况下构建,只需单击右上角的按钮即可。

关于ios - 测试在 Xcode 中通过但在 Circle CI 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32414627/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com