2014-02-26 61 views
8

我能夠使用xcodebuild test命令運行XCTests。但是當我運行這個命令時,它輸出構建日誌,然後在最後有測試日誌。有沒有一種方法可以將測試的輸出(無構建日誌)重定向到單獨的文件?XCTest輸出到文件

我在xcodebuild命令中找不到任何東西。

問候 開發

回答

10

您可以使用ocunit2junit https://github.com/ciryon/OCUnit2JUnit解析生成日誌輸出到JUnit的XML與詹金斯使用。這也適用於XCTest。

xcodebuild test -scheme "MyScheme" -destination "platform=iOS,id=UDID_OF_DEVICE" -derivedDataPath "$(pwd)" 2>&1 | tee out.txt 
cat out.txt | tools/ocunit2junit 

默認輸出junit xml到測試報告。如果你不想要junit xml,那麼你仍然可以使用ocunit2junit作爲解析構建輸出的參考。

+0

我試圖與xcode6.3但不工作。你能指導我嗎? – JohnWhite

+0

自2014年以來,[OCUnit2JUnit](https://github.com/ciryon/OCUnit2JUnit)看起來沒有更新過。Facebook的[xctool](https://github.com/facebook/xctool)聲明它有junit xml記者。你嘗試過嗎? –

+0

是的,我已經嘗試過,但沒有成功... – JohnWhite