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