Sha256: 08c5e4741267803e1711bb5dc576a0d08cbe6e21e23695d9e2cade0430e764e8

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

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/
      # And http://windyroad.com.au/dl/Open%20Source/JUnit.xsd

      containing_folder = ENV['FL_REPORT_PATH'] || FastlaneCore::FastlaneFolder.path || Dir.pwd
      path = File.join(containing_folder, 'report.xml')

      @steps = results
      xml_path = File.join(Fastlane::ROOT, "lib/assets/report_template.xml.erb")
      xml = ERB.new(File.read(xml_path)).result(binding) # https://web.archive.org/web/20160430190141/www.rrn.dk/rubys-erb-templating-system

      xml = xml.gsub('system_', 'system-').delete("\e") # Jenkins cannot parse 'ESC' symbol

      begin
        File.write(path, xml)
      rescue => ex
        UI.error(ex)
        UI.error("Couldn't save report.xml at path '#{File.expand_path(path)}', make sure you have write access to the containing directory.")
      end

      return path
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fastlane-2.225.0 fastlane/lib/fastlane/junit_generator.rb
fastlane-2.224.0 fastlane/lib/fastlane/junit_generator.rb
fastlane-2.223.1 fastlane/lib/fastlane/junit_generator.rb
fastlane-2.223.0 fastlane/lib/fastlane/junit_generator.rb
fastlane-2.222.0 fastlane/lib/fastlane/junit_generator.rb
fastlane-2.221.1 fastlane/lib/fastlane/junit_generator.rb
fastlane-2.221.0 fastlane/lib/fastlane/junit_generator.rb
fastlane-2.220.0 fastlane/lib/fastlane/junit_generator.rb
fastlane-2.219.0 fastlane/lib/fastlane/junit_generator.rb
fastlane-2.218.0 fastlane/lib/fastlane/junit_generator.rb