• Stars
    star
    248
  • Rank 163,560 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Convert xcodebuild plist and xcresult files to JUnit reports

trainer

Twitter: @KrauseFx License Gem

This is an alternative approach to generate JUnit files for your CI (e.g. Jenkins) without parsing the xcodebuild output, but using the Xcode plist or xcresult files instead.

Some Xcode versions has a known issue around not properly closing stdout (Radar), so you can't use xcpretty.

trainer is a more robust and faster approach to generate JUnit reports for your CI system.

By using trainer, the Twitter iOS code base now generates JUnit reports 10 times faster.

xcpretty trainer
Prettify the xcodebuild output βœ… 🚫
Generate JUnit reports βœ… βœ…
Generate HTML reports βœ… 🚫
Works when the xcodebuild output format changed 🚫 βœ…
Show test execution duration βœ… βœ…
Speed πŸš— πŸš€

xcpretty is a great piece of software that is used across all fastlane tools. trainer was built to have the minimum code to generate JUnit reports for your CI system.

More information about the why trainer is useful can be found on my blog.

Use with fastlane

Update to the latest fastlane and run

fastlane add_plugin trainer

Now add the following to your Fastfile

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

trainer(output_directory: ENV["CIRCLE_TEST_REPORTS"])

For more information, check out the fastlane plugin docs.

Without fastlane

Installation

Add this to your Gemfile

gem trainer

and run

bundle install

Alternatively you can install the gem system-wide using sudo gem install trainer.

Usage

If you use fastlane, check out the official fastlane plugin on how to use trainer in fastlane.

Run tests

cd [project]
fastlane scan --derived_data_path "output_dir"

Convert the plist or xcresult files to junit

trainer

You can also pass a custom directory containing the plist or xcresult files

trainer --path ./something

For more information run

trainer --help

Show the test results right in your pull request

To make it easier for you and your contributors to see the test failures, you can use danger with the danger-junit plugin to automatically post the test failures on the GitHub PR.

Thanks

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.

More Repositories

1

xcov

Nice code coverage reporting without hassle
Ruby
558
star
2

fastlane-plugin-appicon

Generate required icon sizes and iconset from a master application icon.
Ruby
338
star
3

fastlane-plugin-s3

fastlane plugin to upload IPA or APK to AWS S3 by @joshdholtz
Ruby
146
star
4

danger-xcov

Danger plugin to validate the code coverage of the files changed in a pull request
Ruby
106
star
5

fastlane-plugin-ionic

Integrate your Ionic build into your Fastlane setup
Ruby
87
star
6

fastlane-plugin-clean_testflight_testers

Automatically remove TestFlight testers that are not actually testing your app
Ruby
66
star
7

security

A Ruby library for interacting with the macOS Keychain
Ruby
54
star
8

fastlane-ftp-plugin

Ftp plugin for Fastlane
Ruby
36
star
9

fastlane-plugin-slack_train

Show a nice train for the build progress in fastlane
Ruby
36
star
10

xcresult

Ruby interface for inspecting data and exporting data from Xcode 11 .xcresult files
Ruby
34
star
11

fastlane-plugin-validate_app

Validate your app with altool before uploading to iTunes Connect
Ruby
16
star
12

xcov-core

Command line tool to parse xccoverage files
Objective-C
14
star
13

fastlane-plugin-applivery

fastlane plugin to upload IPA or APK to Applivery.com
Ruby
12
star
14

fastlane-plugin-aws_sns

fastlane plugin for creating AWS SNS platform applications for iOS and Android apps by @joshdholtz
Ruby
12
star
15

fastlane-plugin-carthage_cache

A fastlane plugin that allows to cache Carthage/Build folder in Amazon S3.
Ruby
11
star
16

README

The collaboration and plugin inclusion guidelines for the fastlane Community organization
3
star
17

fastlane-plugin-get_current_swift_version

Get current Xcode toolchain's Swift version
Ruby
1
star