XCTest output to a file

心已入冬 提交于 2019-12-23 07:51:43

问题


I am able to run XCTests using xcodebuild test command. But when I run this command it outputs the build log and then there is log from test at the end. Is there a way where I can redirect only the output of test (no build logs) to a separate file?

I couldn't find anything in xcodebuild command.

Regards Dev


回答1:


You can use ocunit2junit https://github.com/ciryon/OCUnit2JUnit to parse the build log output into junit xml for use with Jenkins. This works with XCTest as well.

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

This outputs junit xml to test-reports by default. If you don't want junit xml then you can still use ocunit2junit as a reference for parsing the build output.




回答2:


xcpretty has a -r option that outputs the test results into a format of your choice: https://github.com/supermarin/xcpretty



来源:https://stackoverflow.com/questions/22051048/xctest-output-to-a-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!