3

问题:对于这个拉取请求,测试没有通过 CircleCI,但测试在本地通过。为什么?


CircleCI测试输出显示所有FBSnapshotTestCase测试均失败。例如:

✗ testAdjustsFontSizeToFitWidth,((comparisonSuccess__)为真)失败 - 快照比较失败:错误域 = FBSnapshotTestControllerErrorDomain 代码 = 1“无法加载参考图像。” UserInfo=0x7f85f36b0a50 {NSLocalizedFailureReason=未找到参考图像。您需要在记录模式下运行测试,NSLocalizedDescription=Unable to load reference image., FBReferenceImageFilePathKey=/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/testAdjustsFontSizeToFitWidth@2x.png}

[…]

✗ testAttributedTruncationToken, ((comparisonSuccess__) is true) failed - 快照比较失败:错误域=FBSnapshotTestControllerErrorDomain Code=1“无法加载参考图像。” UserInfo=0x7f85f35b06d0 {NSLocalizedFailureReason=未找到参考图像。您需要在记录模式下运行测试,NSLocalizedDescription=无法加载参考图像。,FBReferenceImageFilePathKey=/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/testAttributedTruncationToken@2x.png}

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

图片

在 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
4

1 回答 1

2

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

于 2015-10-30T18:56:39.083 回答