mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
55 lines
1.7 KiB
Go
55 lines
1.7 KiB
Go
/*Package junitxml creates a JUnit XML report from a testjson.Execution.
|
|
*/
|
|
package junitxml
|
|
|
|
import (
|
|
"encoding/xml"
|
|
)
|
|
|
|
// JUnitTestSuites is a collection of JUnit test suites.
|
|
type JUnitTestSuites struct {
|
|
XMLName xml.Name `xml:"testsuites"`
|
|
Suites []JUnitTestSuite `xml:"testsuite,omitempty"`
|
|
}
|
|
|
|
// JUnitTestSuite is a single JUnit test suite which may contain many
|
|
// testcases.
|
|
type JUnitTestSuite struct {
|
|
XMLName xml.Name `xml:"testsuite"`
|
|
Tests int `xml:"tests,attr"`
|
|
Failures int `xml:"failures,attr"`
|
|
Time string `xml:"time,attr"`
|
|
Name string `xml:"name,attr"`
|
|
Properties []JUnitProperty `xml:"properties>property,omitempty"`
|
|
TestCases []JUnitTestCase `xml:"testcase,omitempty"`
|
|
Timestamp string `xml:"timestamp,attr"`
|
|
}
|
|
|
|
// JUnitTestCase is a single test case with its result.
|
|
type JUnitTestCase struct {
|
|
XMLName xml.Name `xml:"testcase"`
|
|
Classname string `xml:"classname,attr"`
|
|
Name string `xml:"name,attr"`
|
|
Time string `xml:"time,attr"`
|
|
SkipMessage *JUnitSkipMessage `xml:"skipped,omitempty"`
|
|
Failure *JUnitFailure `xml:"failure,omitempty"`
|
|
}
|
|
|
|
// JUnitSkipMessage contains the reason why a testcase was skipped.
|
|
type JUnitSkipMessage struct {
|
|
Message string `xml:"message,attr"`
|
|
}
|
|
|
|
// JUnitProperty represents a key/value pair used to define properties.
|
|
type JUnitProperty struct {
|
|
Name string `xml:"name,attr"`
|
|
Value string `xml:"value,attr"`
|
|
}
|
|
|
|
// JUnitFailure contains data related to a failed test.
|
|
type JUnitFailure struct {
|
|
Message string `xml:"message,attr"`
|
|
Type string `xml:"type,attr"`
|
|
Contents string `xml:",chardata"`
|
|
}
|