8

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

2 Answers 2

11

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
  • I have tried with xcode6.3 but not working. Can you please guide me? Commented Aug 22, 2015 at 10:21
  • It looks like the OCUnit2JUnit hasn't been updated since 2014. Facebook's xctool states that it has junit xml reporters. Have you tried that? Commented Aug 22, 2015 at 17:15
5

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.