Adjust xml annotations to allow unmarshal of test suites

The xml annotations currently used allow for marshalling of
the test suites but fail to unmarshal them because of the
lack of an xml annotation on the slice fields for test suites
and test cases.

By adding those annotations, these types can be more widely reused.

Fixes #92
This commit is contained in:
John Schnake
2019-08-20 21:20:04 -05:00
parent af01ea7f80
commit c6aeb8e0a5
2 changed files with 67 additions and 3 deletions

View File

@ -14,8 +14,8 @@ import (
// JUnitTestSuites is a collection of JUnit test suites.
type JUnitTestSuites struct {
XMLName xml.Name `xml:"testsuites"`
Suites []JUnitTestSuite
XMLName xml.Name `xml:"testsuites"`
Suites []JUnitTestSuite `xml:"testsuite"`
}
// JUnitTestSuite is a single JUnit test suite which may contain many
@ -27,7 +27,7 @@ type JUnitTestSuite struct {
Time string `xml:"time,attr"`
Name string `xml:"name,attr"`
Properties []JUnitProperty `xml:"properties>property,omitempty"`
TestCases []JUnitTestCase
TestCases []JUnitTestCase `xml:"testcase"`
}
// JUnitTestCase is a single test case with its result.