Method: Res::Parsers::Junit#initialize
- Defined in:
- lib/res/parsers/junit.rb
#initialize(junit_xml) ⇒ Junit
Returns a new instance of Junit.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/res/parsers/junit.rb', line 10 def initialize(junit_xml) file = File.open(junit_xml, "rb") begin junit = Ox.parse(file.read) rescue Ox::ParseError => e raise "Invalid xunit XML format. Error: #{e}" end file.close result = attach_suite(junit) ir = ::Res::IR.new( :type => 'Junit', :started => '', :finished => Time.now, :results => result ) @io = File.open('./junit.res', 'w') @io.puts ir.json @io.close end |