class Gitlab::QA::Report::TestResult::JUnitTestResult

def failures_from_exceptions

def failures_from_exceptions
  failures = report.search('failure')
  return [] if failures.empty?
  failures.map do |exception|
    trace = exception.content.split("\n").map(&:strip)
    spec_file_first_index = trace.rindex do |line|
      line.include?(File.basename(report['file']))
    end
    {
      'message' => "#{exception['type']}: #{exception['message']}",
      'stacktrace' => trace.slice(0..spec_file_first_index).join("\n")
    }
  end
end