問題:對於this pull request,測試不會通過CircleCI,而是測試通過本地。爲什麼?測試在Xcode中通過但在Circle CI上失敗
的CircleCI test output顯示所有FBSnapshotTestCase
測試失敗。例如:
✗testAdjustsFontSizeToFitWidth,((comparisonSuccess__)爲真)失敗 - 快照比較失敗:錯誤域= FBSnapshotTestControllerErrorDomain代碼= 1 「無法加載參考圖像」。 UserInfo = 0x7f85f36b0a50 {NSLocalizedFailureReason = 未找到參考圖像。你需要運行在拍攝模式下的測試,NSLocalizedDescription =無法加載參考圖像,FBReferenceImageFilePathKey=/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/[email protected]}
[...]
✗testAttributedTruncationToken,((comparisonSuccess__)爲true)失敗 - 快照比較失敗:錯誤域= FBSnapshotTestControllerErrorDomain代碼= 1「無法加載參考圖像。 UserInfo = 0x7f85f35b06d0 {NSLocalizedFailureReason = 找不到參考圖像。你需要運行在拍攝模式下的測試,NSLocalizedDescription =無法加載參考圖像,FBReferenceImageFilePathKey=/Users/distiller/TTTAttributedLabel/Example/TTTAttributedLabelTests/ReferenceImages_32/TTTAttributedLabelTests/[email protected]}
然而,相同的測試本地通:
在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
- 是什麼原因造成的?
- 如何獲得通過CircleCI的測試?
- 可能相關:this
FBSnapshotTestCase
issue