Documentation
¶
Overview ¶
Package junit defines a JUnit XML report and includes convenience methods for working with these reports.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Output ¶
type Output struct {
Data string `xml:",cdata"`
}
Output represents output written to stdout or sderr.
type Properties ¶
type Properties struct {
Properties []Property `xml:"property"`
}
Properties represents additional information of a test suite.
type Result ¶
type Result struct {
Message string `xml:"message,attr"`
Type string `xml:"type,attr,omitempty"`
Data string `xml:",cdata"`
}
Result represents the result of a single test.
type Testcase ¶
type Testcase struct {
// required attributes
Name string `xml:"name,attr"`
Classname string `xml:"classname,attr"`
// optional attributes
Time string `xml:"time,attr,omitempty"` // duration in seconds
Status string `xml:"status,attr,omitempty"`
Properties *Properties `xml:"properties,omitempty"`
Skipped *Result `xml:"skipped,omitempty"`
Error *Result `xml:"error,omitempty"`
Failure *Result `xml:"failure,omitempty"`
SystemOut *Output `xml:"system-out,omitempty"`
SystemErr *Output `xml:"system-err,omitempty"`
}
Testcase represents a single test with its results.
type Testsuite ¶
type Testsuite struct {
// required attributes
Name string `xml:"name,attr"`
Tests int `xml:"tests,attr"`
Failures int `xml:"failures,attr"`
Errors int `xml:"errors,attr"`
ID int `xml:"id,attr"`
// optional attributes
Disabled int `xml:"disabled,attr,omitempty"`
Hostname string `xml:"hostname,attr,omitempty"`
Package string `xml:"package,attr,omitempty"`
Skipped int `xml:"skipped,attr,omitempty"`
Time string `xml:"time,attr"` // duration in seconds
Timestamp string `xml:"timestamp,attr,omitempty"` // date and time in ISO8601
File string `xml:"file,attr,omitempty"`
Properties *[]Property `xml:"properties>property,omitempty"`
Testcases []Testcase `xml:"testcase,omitempty"`
SystemOut *Output `xml:"system-out,omitempty"`
SystemErr *Output `xml:"system-err,omitempty"`
}
Testsuite is a single JUnit testsuite containing testcases.
func (*Testsuite) AddProperty ¶
AddProperty adds a property with the given name and value to this Testsuite.
func (*Testsuite) AddTestcase ¶
AddTestcase adds Testcase tc to this Testsuite.
func (*Testsuite) SetTimestamp ¶
SetTimestamp sets the timestamp in this Testsuite.
type Testsuites ¶
type Testsuites struct {
XMLName xml.Name `xml:"testsuites"`
Name string `xml:"name,attr,omitempty"`
Time string `xml:"time,attr,omitempty"` // total duration in seconds
Tests int `xml:"tests,attr,omitempty"`
Errors int `xml:"errors,attr,omitempty"`
Failures int `xml:"failures,attr,omitempty"`
Skipped int `xml:"skipped,attr,omitempty"`
Disabled int `xml:"disabled,attr,omitempty"`
Suites []Testsuite `xml:"testsuite,omitempty"`
}
Testsuites is a collection of JUnit testsuites.
func CreateFromReport ¶
func CreateFromReport(report gtr.Report, hostname string, owners Owners) Testsuites
CreateFromReport creates a JUnit representation of the given gtr.Report.
func (*Testsuites) AddSuite ¶
func (t *Testsuites) AddSuite(ts Testsuite)
AddSuite adds a Testsuite and updates this testssuites' totals.