测试在Xcode中传递但在Circle CI上失败

时间:2015-09-05 15:15:03

标签: ios continuous-integration circleci fbsnapshottestcase

问题:对于this pull request,测试不会传递给CircleCI,但测试会在本地传递。为什么呢?

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

  

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

     

[...]

     

✗testAttributedTruncationToken,((comparisonSuccess__)为true)失败 - 快照比较失败:错误Domain = FBSnapshotTestControllerErrorDomain Code = 1“无法加载参考图像。” UserInfo = 0x7f85f35b06d0 {NSLocalizedFailureReason = 未找到参考图像。您需要以记录模式运行测试,NSLocalizedDescription =无法加载参考图像。,FBReferenceImageFilePathKey = / User / 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

1 个答案:

答案 0 :(得分:2)

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