class SpecTracker::TestReportParser::JUnit::Parser

Attributes

test_result_mapper[R]

Public Class Methods

new() click to toggle source
# File lib/spec_tracker/test_report_parser/j_unit/parser.rb, line 5
def initialize
  @test_result_mapper = Mapper.new
end

Private Instance Methods

file_extension() click to toggle source
# File lib/spec_tracker/test_report_parser/j_unit/parser.rb, line 21
def file_extension
  '.xml'.freeze
end
parse_single(file) click to toggle source
# File lib/spec_tracker/test_report_parser/j_unit/parser.rb, line 13
def parse_single(file)
  test_results = []
  return test_results unless valid_extension?(file)
  xml_report = File.open(file) {|f| Nokogiri::XML(f)}
  test_cases(xml_report).each {|test_case| test_results << test_result_mapper.map(test_case)}
  test_results
end
test_cases(xml_report) click to toggle source
# File lib/spec_tracker/test_report_parser/j_unit/parser.rb, line 25
def test_cases(xml_report)
  xml_report.xpath('//testcase')
end