junit: Make failures and errors required fields

Fixes #101
This commit is contained in:
Joël Stemmer 2022-02-24 23:52:18 +00:00
parent 2ece8eae1a
commit fc0a210dc9
34 changed files with 55 additions and 55 deletions

View File

@ -34,13 +34,13 @@ func (t *Testsuites) AddSuite(ts Testsuite) {
// Testsuite is a single JUnit testsuite containing testcases.
type Testsuite struct {
// required attributes
Name string `xml:"name,attr"`
Tests int `xml:"tests,attr"`
Name string `xml:"name,attr"`
Tests int `xml:"tests,attr"`
Failures int `xml:"failures,attr"`
Errors int `xml:"errors,attr"`
// optional attributes
Disabled int `xml:"disabled,attr,omitempty"`
Errors int `xml:"errors,attr"`
Failures int `xml:"failures,attr"`
Hostname string `xml:"hostname,attr,omitempty"`
ID int `xml:"id,attr,omitempty"`
Package string `xml:"package,attr,omitempty"`

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" failures="1">
<testsuite tests="2" failures="1" time="0.151" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="1" errors="0" time="0.151" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="0.150" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.150" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,5 +1,5 @@
<testsuites tests="2">
<testsuite tests="2" failures="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,12 +1,12 @@
<testsuites tests="4" failures="1">
<testsuite tests="2" failures="0" time="0.160" name="package/name1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.160" name="package/name1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase classname="name1" name="TestOne" time="0.060"></testcase>
<testcase classname="name1" name="TestTwo" time="0.100"></testcase>
</testsuite>
<testsuite tests="2" failures="1" time="0.151" name="package/name2">
<testsuite tests="2" failures="1" errors="0" time="0.151" name="package/name2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="0.160" name="test/package" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.160" name="test/package" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="0.440" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.440" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
<property name="coverage.statements.pct" value="13.37"></property>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3">
<testsuite tests="2" failures="0" time="0.400" name="package1/foo" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.400" name="package1/foo" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
<property name="coverage.statements.pct" value="10.00"></property>
@ -8,7 +8,7 @@
<testcase classname="foo" name="TestA" time="0.100"></testcase>
<testcase classname="foo" name="TestB" time="0.300"></testcase>
</testsuite>
<testsuite tests="1" failures="0" time="4.200" name="package2/bar">
<testsuite tests="1" failures="0" errors="0" time="4.200" name="package2/bar" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
<property name="coverage.statements.pct" value="99.80"></property>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="0.050" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.050" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="18" failures="3" skipped="2">
<testsuite tests="18" failures="3" time="0.050" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="18" failures="3">
<testsuite tests="18" failures="3" errors="0" skipped="0" time="0.050" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="5" errors="3">
<testsuite tests="1" failures="0" time="0.100" name="package/name/passing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="5" failures="3">
<testsuite tests="1" failures="0" errors="0" time="0.100" name="package/name/passing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase classname="passing1" name="TestA" time="0.100"></testcase>
</testsuite>
<testsuite tests="1" failures="0" time="0.100" name="package/name/passing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="0" errors="0" time="0.100" name="package/name/passing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase classname="passing2" name="TestB" time="0.100"></testcase>
</testsuite>
<testsuite tests="1" failures="1" time="0.000" name="package/name/failing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/failing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
@ -20,7 +20,7 @@
<failure message="Failed" type="">failing1/failing_test.go:15: undefined: x</failure>
</testcase>
</testsuite>
<testsuite tests="1" failures="1" time="0.000" name="package/name/failing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/failing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
@ -28,7 +28,7 @@
<failure message="Failed" type="">failing2/another_failing_test.go:20: undefined: y</failure>
</testcase>
</testsuite>
<testsuite tests="1" failures="1" time="0.000" name="package/name/setupfailing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/setupfailing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" errors="2">
<testsuite tests="1" failures="1" time="0.003" name="package/panic" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="2" failures="2">
<testsuite tests="1" failures="1" errors="0" time="0.003" name="package/panic" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
@ -8,7 +8,7 @@
<failure message="Failed" type="">panic: init&#xA;stacktrace</failure>
</testcase>
</testsuite>
<testsuite tests="1" failures="1" time="0.003" name="package/panic2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="1" errors="0" time="0.003" name="package/panic2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite tests="0" failures="0" time="0.001" name="package/empty" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="0" failures="0" errors="0" time="0.001" name="package/empty" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3">
<testsuite tests="3" failures="0" time="0.001" name="package/repeated-names" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="3" failures="0" errors="0" time="0.001" name="package/repeated-names" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failures="1">
<testsuite tests="1" failures="1" time="0.015" name="race_test" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="1" errors="0" time="0.015" name="race_test" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3">
<testsuite tests="2" failures="0" time="0.400" name="package1/foo" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.400" name="package1/foo" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
<property name="coverage.statements.pct" value="10.00"></property>
@ -8,7 +8,7 @@
<testcase classname="foo" name="TestA" time="0.100"></testcase>
<testcase classname="foo" name="TestB" time="0.300"></testcase>
</testsuite>
<testsuite tests="1" failures="0" time="4.200" name="package2/bar" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="0" errors="0" time="4.200" name="package2/bar" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
<property name="coverage.statements.pct" value="99.80"></property>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="0.160" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="3">
<testsuite tests="3" failures="3" time="3.010" name="pkg/parallel" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="3" failures="3" errors="0" time="3.010" name="pkg/parallel" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1">
<testsuite tests="1" failures="0" time="0.000" name="package/one" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="0" errors="0" time="0.000" name="package/one" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="3.212" name="package/basic" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="3.212" name="package/basic" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="9.415" name="package/one" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="9.415" name="package/one" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="6">
<testsuite tests="6" failures="0" time="1.382" name="package3/baz" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="6" failures="0" errors="0" time="1.382" name="package3/baz" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="14.211" name="pkg/count" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="14.211" name="pkg/count" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="6">
<testsuite tests="2" failures="0" time="7.267" name="mycode/common" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="7.267" name="mycode/common" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase classname="common" name="BenchmarkParse" time="0.000001591"></testcase>
<testcase classname="common" name="BenchmarkNewTask" time="0.000000391"></testcase>
</testsuite>
<testsuite tests="4" failures="0" time="47.084" name="mycode/benchmarks/channels" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="4" failures="0" errors="0" time="47.084" name="mycode/benchmarks/channels" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3">
<testsuite tests="3" failures="0" time="4.344" name="really/small" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="3" failures="0" errors="0" time="4.344" name="really/small" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1">
<testsuite tests="1" failures="0" time="9.467" name="single/cpu" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="0" errors="0" time="9.467" name="single/cpu" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1">
<testsuite tests="1" failures="0" time="1.522" name="sixteen/cpu" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="0" errors="0" time="1.522" name="sixteen/cpu" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="17" failures="9">
<testsuite tests="17" failures="9" time="4.567" name="package/name1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="17" failures="9" errors="0" time="4.567" name="package/name1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="5" errors="3">
<testsuite tests="1" failures="0" time="0.100" name="package/name/passing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="5" failures="3">
<testsuite tests="1" failures="0" errors="0" time="0.100" name="package/name/passing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase classname="passing1" name="TestA" time="0.100"></testcase>
</testsuite>
<testsuite tests="1" failures="0" time="0.100" name="package/name/passing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="0" errors="0" time="0.100" name="package/name/passing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase classname="passing2" name="TestB" time="0.100"></testcase>
</testsuite>
<testsuite tests="1" failures="1" time="0.000" name="package/name/failing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/failing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
@ -20,7 +20,7 @@
<failure message="Failed" type="">failing1/failing_test.go:15: undefined: x</failure>
</testcase>
</testsuite>
<testsuite tests="1" failures="1" time="0.000" name="package/name/failing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/failing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
@ -28,7 +28,7 @@
<failure message="Failed" type="">failing2/another_failing_test.go:20: undefined: y</failure>
</testcase>
</testsuite>
<testsuite tests="1" failures="1" time="0.000" name="package/name/setupfailing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/setupfailing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" errors="1">
<testsuite tests="2" failures="1" time="0.005" name="github.com/jstemmer/test/failedsummary" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuites tests="2" failures="1">
<testsuite tests="2" failures="1" errors="0" time="0.005" name="github.com/jstemmer/test/failedsummary" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2">
<testsuite tests="2" failures="0" time="83.202" name="compress/flate" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<testsuite tests="2" failures="0" errors="0" time="83.202" name="compress/flate" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>