问题:对于这个拉取请求,测试没有通过 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
- 这是什么原因造成的?
- 如何让测试通过 CircleCI?
- 可能相关:这个
FBSnapshotTestCase
问题