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
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.
xcpretty has a -r option that outputs the test results into a format of your choice: https://github.com/supermarin/xcpretty
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With