...

Source file src/k8s.io/kubernetes/third_party/forked/gotestsum/junitxml/report.go

Documentation: k8s.io/kubernetes/third_party/forked/gotestsum/junitxml

     1  /*Package junitxml creates a JUnit XML report from a testjson.Execution.
     2   */
     3  package junitxml
     4  
     5  import (
     6  	"encoding/xml"
     7  )
     8  
     9  // JUnitTestSuites is a collection of JUnit test suites.
    10  type JUnitTestSuites struct {
    11  	XMLName xml.Name `xml:"testsuites"`
    12  	Suites  []JUnitTestSuite `xml:"testsuite,omitempty"`
    13  }
    14  
    15  // JUnitTestSuite is a single JUnit test suite which may contain many
    16  // testcases.
    17  type JUnitTestSuite struct {
    18  	XMLName    xml.Name        `xml:"testsuite"`
    19  	Tests      int             `xml:"tests,attr"`
    20  	Failures   int             `xml:"failures,attr"`
    21  	Time       string          `xml:"time,attr"`
    22  	Name       string          `xml:"name,attr"`
    23  	Properties []JUnitProperty `xml:"properties>property,omitempty"`
    24  	TestCases  []JUnitTestCase `xml:"testcase,omitempty"`
    25  	Timestamp  string `xml:"timestamp,attr"`
    26  }
    27  
    28  // JUnitTestCase is a single test case with its result.
    29  type JUnitTestCase struct {
    30  	XMLName     xml.Name          `xml:"testcase"`
    31  	Classname   string            `xml:"classname,attr"`
    32  	Name        string            `xml:"name,attr"`
    33  	Time        string            `xml:"time,attr"`
    34  	SkipMessage *JUnitSkipMessage `xml:"skipped,omitempty"`
    35  	Failure     *JUnitFailure     `xml:"failure,omitempty"`
    36  }
    37  
    38  // JUnitSkipMessage contains the reason why a testcase was skipped.
    39  type JUnitSkipMessage struct {
    40  	Message string `xml:"message,attr"`
    41  }
    42  
    43  // JUnitProperty represents a key/value pair used to define properties.
    44  type JUnitProperty struct {
    45  	Name  string `xml:"name,attr"`
    46  	Value string `xml:"value,attr"`
    47  }
    48  
    49  // JUnitFailure contains data related to a failed test.
    50  type JUnitFailure struct {
    51  	Message  string `xml:"message,attr"`
    52  	Type     string `xml:"type,attr"`
    53  	Contents string `xml:",chardata"`
    54  }
    55  

View as plain text