XCTest 输出到文件 [英] XCTest output to a file
问题描述
我能够使用 xcodebuild test
命令运行 XCTest.但是当我运行这个命令时,它会输出构建日志,然后最后有来自测试的日志.有没有办法只将测试的输出(没有构建日志)重定向到单独的文件?
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?
我在 xcodebuild 命令中找不到任何东西.
I couldn't find anything in xcodebuild command.
问候开发
推荐答案
你可以使用 ocunit2junit https://github.com/ciryon/OCUnit2JUnit 将构建日志输出解析为 junit xml 以供 Jenkins 使用.这也适用于 XCTest.
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
默认情况下,这会将 junit xml 输出到测试报告.如果您不想要 junit xml,那么您仍然可以使用 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.
这篇关于XCTest 输出到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!