Sha256: c95c1e65caf096cb5a901e481f9f7cfe19ca0247f52e0d493d00017719e4c736

Contents?: true

Size: 1.04 KB

Versions: 66

Compression:

Stored size: 1.04 KB

Contents

require 'nokogiri'

module Fastlane
  class JUnitGenerator
    def self.generate(results)
      # JUnit file documentation: http://llg.cubic.org/docs/junit/
      # And http://nelsonwells.net/2012/09/how-jenkins-ci-parses-and-displays-junit-output/

      containing_folder = Fastlane::FastlaneFolder.path || Dir.pwd
      path = File.join(containing_folder, 'report.xml')

      builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
        xml.testsuites(name: 'fastlane') do
          xml.testsuite(name: 'deploy') do
            results.each_with_index do |current, index|
              xml.testcase(name: [index, current[:name]].join(': '), time: current[:time]) do
                xml.failure(message: current[:error]) if current[:error]
                xml.system_out current[:output] if current[:output]
              end
            end
          end
        end
      end
      result = builder.to_xml.gsub('system_', 'system-').gsub("", ' ') # Jenkins can not parse 'ESC' symbol

      File.write(path, result)

      path
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
fastlane-1.20.0 lib/fastlane/junit_generator.rb
fastlane-1.19.0 lib/fastlane/junit_generator.rb
fastlane-1.18.0 lib/fastlane/junit_generator.rb
fastlane-1.17.1 lib/fastlane/junit_generator.rb
fastlane-1.17.0 lib/fastlane/junit_generator.rb
fastlane-1.16.0 lib/fastlane/junit_generator.rb
fastlane-1.15.0 lib/fastlane/junit_generator.rb
fastlane-1.14.1 lib/fastlane/junit_generator.rb
fastlane-1.14.0 lib/fastlane/junit_generator.rb
fastlane-1.13.1 lib/fastlane/junit_generator.rb
fastlane-1.13.0 lib/fastlane/junit_generator.rb
fastlane-1.12.0 lib/fastlane/junit_generator.rb
fastlane-1.11.0 lib/fastlane/junit_generator.rb
fastlane-1.10.0 lib/fastlane/junit_generator.rb
fastlane-1.9.0 lib/fastlane/junit_generator.rb
fastlane-1.8.0 lib/fastlane/junit_generator.rb
fastlane-1.7.3 lib/fastlane/junit_generator.rb
fastlane-1.7.2 lib/fastlane/junit_generator.rb
fastlane-1.7.1 lib/fastlane/junit_generator.rb
fastlane-1.7.0 lib/fastlane/junit_generator.rb