2015-09-05 80 views
1

問題:對於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]}

然而,相同的測試本地通:

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 

回答

2

你試過沒有緩存運行的版本?這通常會爲我解決這些問題。要在沒有緩存的情況下構建,只需點擊右上角的按鈕即可。

相關問題