Skip to content

Commit

Permalink
[Bug Fix] Better junit reporting (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfcarlson authored and corthon committed Aug 20, 2019
1 parent 90458d6 commit 8f798d0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions edk2toollib/log/junit_report_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import time
from xml.sax.saxutils import escape


class JunitReportError(object):
Expand Down Expand Up @@ -76,15 +77,17 @@ def SetSkipped(self):
self.Time = time.time() - self._StartTime

def LogStdOut(self, msg):
self.StdOut += msg.strip() + "\n "
self.StdOut += escape(msg.strip()) + "\n "

def LogStdError(self, msg):
self.StdErr += msg.strip() + "\n "
self.StdErr += escape(msg.strip()) + "\n "

def Output(self, outstream):
outstream.write('<testcase classname="{0}" name="{1}" time="{2}">'.format(self.ClassName, self.Name, self.Time))
if self.Status == JunitReportTestCase.SKIPPED:
outstream.write('<skipped />')
outstream.write('<skipped type="skipped">')
outstream.write(self.StdOut)
outstream.write('</skipped>')
elif self.Status == JunitReportTestCase.FAILED:
outstream.write('<failure message="{0}" type="{1}" />'.format(self.FailureMsg.Message,
self.FailureMsg.Type))
Expand Down

0 comments on commit 8f798d0

Please sign in to comment.