mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-07-06 05:57:54 -05:00
junit: Make Testsuites.ID a required field
This commit is contained in:
@ -43,11 +43,11 @@ type Testsuite struct {
|
||||
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"`
|
||||
ID int `xml:"id,attr,omitempty"`
|
||||
Package string `xml:"package,attr,omitempty"`
|
||||
Skipped int `xml:"skipped,attr,omitempty"`
|
||||
Time string `xml:"time,attr"` // duration in seconds
|
||||
@ -136,6 +136,7 @@ func CreateFromReport(report gtr.Report, hostname string) Testsuites {
|
||||
suite := Testsuite{
|
||||
Name: pkg.Name,
|
||||
Hostname: hostname,
|
||||
ID: len(suites.Suites),
|
||||
}
|
||||
|
||||
if !pkg.Timestamp.IsZero() {
|
||||
|
@ -32,6 +32,7 @@ func TestCreateFromReport(t *testing.T) {
|
||||
Tests: 1,
|
||||
Failures: 1,
|
||||
Time: "0.000",
|
||||
ID: 0,
|
||||
Testcases: []Testcase{
|
||||
{
|
||||
Name: "BenchmarkFail",
|
||||
@ -64,7 +65,7 @@ func TestMarshalUnmarshal(t *testing.T) {
|
||||
Errors: 1,
|
||||
Failures: 1,
|
||||
Hostname: "localhost",
|
||||
ID: 1,
|
||||
ID: 0,
|
||||
Package: "package",
|
||||
Skipped: 1,
|
||||
Time: "12.345",
|
||||
|
Reference in New Issue
Block a user