mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-05 13:08:07 -05:00
Do not create <failure> tag when message is empty
This commit is contained in:
parent
92be560b6c
commit
8cf088e24f
@ -22,7 +22,7 @@ type JUnitTestCase struct {
|
||||
Classname string `xml:"classname,attr"`
|
||||
Name string `xml:"name,attr"`
|
||||
Time string `xml:"time,attr"`
|
||||
Failure *string `xml:"failure"`
|
||||
Failure string `xml:"failure,omitempty"`
|
||||
}
|
||||
|
||||
func JUnitReportXML(report *Report, w io.Writer) error {
|
||||
@ -49,15 +49,14 @@ func JUnitReportXML(report *Report, w io.Writer) error {
|
||||
Classname: classname,
|
||||
Name: test.Name,
|
||||
Time: formatTime(test.Time),
|
||||
Failure: nil,
|
||||
Failure: "",
|
||||
}
|
||||
|
||||
if test.Result == FAIL {
|
||||
ts.Failures += 1
|
||||
|
||||
// TODO: set error message
|
||||
msg := ""
|
||||
testCase.Failure = &msg
|
||||
testCase.Failure = ""
|
||||
}
|
||||
|
||||
ts.TestCases = append(ts.TestCases, testCase)
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuite tests="2" failures="1" time="0.151" name="package/name">
|
||||
<testcase classname="name" name="TestOne" time="0.020">
|
||||
<failure></failure>
|
||||
</testcase>
|
||||
<testcase classname="name" name="TestOne" time="0.020"></testcase>
|
||||
<testcase classname="name" name="TestTwo" time="0.130"></testcase>
|
||||
</testsuite>
|
||||
|
Loading…
x
Reference in New Issue
Block a user