OGeek|极客世界-中国程序员成长平台

标题: ios - 测试在 Xcode 中通过,但在 Circle CI 中失败 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 16:14
标题: ios - 测试在 Xcode 中通过,但在 Circle CI 中失败

问题:对于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/[email protected]}

[…]

✗ 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/[email protected]}

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

image

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

/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/[email protected]

但是,图像确实存在于 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



Best Answer-推荐答案


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

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






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4