Convert xcodebuild plist and xcresult files to JUnit reports
This is an alternative approach to generate JUnit files for your CI (e.g. Jenkins) without parsing the
xcodebuildoutput, but using the Xcode
Some Xcode versions has a known issue around not properly closing
stdout(Radar), so you can't use xcpretty.
traineris a more robust and faster approach to generate JUnit reports for your CI system.
By usingtrainer, the Twitter iOS code base now generates JUnit reports 10 times faster.
| | xcpretty | trainer --------------------------|------------------------------|------------------------------ Prettify the
xcodebuildoutput | :whitecheckmark: | :noentrysign: Generate JUnit reports | :whitecheckmark: | :whitecheckmark: Generate HTML reports | :whitecheckmark: | :noentrysign: Works when the
xcodebuildoutput format changed | :noentrysign: | :whitecheckmark: Show test execution duration | :whitecheckmark: | :whitecheckmark: Speed | :car: | :rocket:
trainerwas built to have the minimum code to generate JUnit reports for your CI system.
More information about the why
traineris useful can be found on my blog.
Update to the latest fastlane and run
fastlane add_plugin trainer
Now add the following to your
lane :test do scan(scheme: "ThemojiUITests", output_types: "", fail_build: false)
trainer(output_directory: ".") end
This will generate the JUnit file in the current directory. You can specify any path you want, just make sure to have it clean for every run so that your CI system knows which one to pick.
If you use circle, use the following to automatically publish the JUnit reports
For more information, check out the fastlane plugin docs.
Add this to your
gem trainerand run
Alternatively you can install the gem system-wide using
sudo gem install trainer.
If you use
fastlane, check out the official fastlane plugin on how to use
cd [project] fastlane scan --derived_data_path "output_dir"
You can also pass a custom directory containing the plist or xcresult files
trainer --path ./something
For more information run
After the lobbying of @steipete and the comment
How does Xcode Server parse the results?
I started investigating alternative approaches on how to parse test results.
For more information about the plist files that are being used, check out Michele's blog post.