testdata: Create generate-golden.go to generate report.xml files

The testdata directory contains various inputs and the resulting
report.xml that is expected to be generated. Making changes that result
in differences in the generated XML reports requires the report.xml
files to be manually updated. This is time consuming and error prone.

The generate-golden.go script (re)generates all report.xml files in the
testdata directory from the corresponding input. This can be done by
simply running `go generate` from within the testdata directory. Make
sure the generated reports contain the changes you expected before
committing them.

As part of this change, all reports have been regenerated. The diffs in
the report.xml files are caused by the following recent changes:
- XML attributes now appear in the order as defined in the structs in
  the junit package.
- Failure and error messages are now wrapped in <![CDATA[]]>.
- Package names are no longer truncated to the last path component.
This commit is contained in:
Joël Stemmer 2022-03-18 22:22:11 +00:00
parent e0a4faed09
commit 3adb6bab4b
36 changed files with 414 additions and 188 deletions

View File

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

View File

@ -1,13 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" failures="1"> <testsuites tests="2" failures="1">
<testsuite tests="2" failures="1" errors="0" time="0.151" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name" tests="2" failures="1" errors="0" hostname="hostname" time="0.151" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="name" name="TestOne" time="0.020"> <testcase name="TestOne" classname="package/name" time="0.020">
<failure message="Failed" type="">file_test.go:11: Error message&#xA;file_test.go:11: Longer&#xA;&#x9;error&#xA;&#x9;message.</failure> <failure message="Failed"><![CDATA[file_test.go:11: Error message
file_test.go:11: Longer
error
message.]]></failure>
</testcase> </testcase>
<testcase classname="name" name="TestTwo" time="0.130"></testcase> <testcase name="TestTwo" classname="package/name" time="0.130"></testcase>
<system-out><![CDATA[exit status 1]]></system-out> <system-out><![CDATA[exit status 1]]></system-out>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" skipped="1"> <testsuites tests="2" skipped="1">
<testsuite tests="2" failures="0" errors="0" skipped="1" time="0.150" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name" tests="2" failures="0" errors="0" hostname="hostname" skipped="1" time="0.150" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="name" name="TestOne" time="0.020"> <testcase name="TestOne" classname="package/name" time="0.020">
<skipped message="file_test.go:11: Skip message"></skipped> <skipped message="file_test.go:11: Skip message"></skipped>
</testcase> </testcase>
<testcase classname="name" name="TestTwo" time="0.130"></testcase> <testcase name="TestTwo" classname="package/name" time="0.130"></testcase>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

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

View File

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

View File

@ -1,19 +1,22 @@
<testsuites tests="4" failures="1"> <testsuites tests="4" failures="1">
<testsuite tests="2" failures="0" errors="0" time="0.160" name="package/name1" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name1" tests="2" failures="0" errors="0" hostname="hostname" time="0.160" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="name1" name="TestOne" time="0.060"></testcase> <testcase name="TestOne" classname="package/name1" time="0.060"></testcase>
<testcase classname="name1" name="TestTwo" time="0.100"></testcase> <testcase name="TestTwo" classname="package/name1" time="0.100"></testcase>
</testsuite> </testsuite>
<testsuite tests="2" failures="1" errors="0" time="0.151" name="package/name2" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name2" tests="2" failures="1" errors="0" hostname="hostname" time="0.151" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="name2" name="TestOne" time="0.020"> <testcase name="TestOne" classname="package/name2" time="0.020">
<failure message="Failed" type="">file_test.go:11: Error message&#xA;file_test.go:11: Longer&#xA;&#x9;error&#xA;&#x9;message.</failure> <failure message="Failed"><![CDATA[file_test.go:11: Error message
file_test.go:11: Longer
error
message.]]></failure>
</testcase> </testcase>
<testcase classname="name2" name="TestTwo" time="0.130"></testcase> <testcase name="TestTwo" classname="package/name2" time="0.130"></testcase>
<system-out><![CDATA[exit status 1]]></system-out> <system-out><![CDATA[exit status 1]]></system-out>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,36 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="18" failures="3" skipped="2"> <testsuites tests="18" failures="3" skipped="2">
<testsuite tests="18" failures="3" errors="0" skipped="2" time="0.050" name="package/name" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name" tests="18" failures="3" errors="0" hostname="hostname" skipped="2" time="0.050" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="name" name="TestOne" time="0.010"></testcase> <testcase name="TestOne" classname="package/name" time="0.010"></testcase>
<testcase classname="name" name="TestOne/Child" time="0.020"></testcase> <testcase name="TestOne/Child" classname="package/name" time="0.020"></testcase>
<testcase classname="name" name="TestOne/Child#01" time="0.030"></testcase> <testcase name="TestOne/Child#01" classname="package/name" time="0.030"></testcase>
<testcase classname="name" name="TestOne/Child=02" time="0.040"></testcase> <testcase name="TestOne/Child=02" classname="package/name" time="0.040"></testcase>
<testcase classname="name" name="TestTwo" time="0.010"></testcase> <testcase name="TestTwo" classname="package/name" time="0.010"></testcase>
<testcase classname="name" name="TestTwo/Child" time="0.020"></testcase> <testcase name="TestTwo/Child" classname="package/name" time="0.020"></testcase>
<testcase classname="name" name="TestTwo/Child#01" time="0.030"></testcase> <testcase name="TestTwo/Child#01" classname="package/name" time="0.030"></testcase>
<testcase classname="name" name="TestTwo/Child=02" time="0.040"></testcase> <testcase name="TestTwo/Child=02" classname="package/name" time="0.040"></testcase>
<testcase classname="name" name="TestThree" time="0.010"></testcase> <testcase name="TestThree" classname="package/name" time="0.010"></testcase>
<testcase classname="name" name="TestThree/a#1" time="0.020"></testcase> <testcase name="TestThree/a#1" classname="package/name" time="0.020"></testcase>
<testcase classname="name" name="TestThree/a#1/b#1" time="0.030"></testcase> <testcase name="TestThree/a#1/b#1" classname="package/name" time="0.030"></testcase>
<testcase classname="name" name="TestThree/a#1/b#1/c#1" time="0.040"></testcase> <testcase name="TestThree/a#1/b#1/c#1" classname="package/name" time="0.040"></testcase>
<testcase classname="name" name="TestFour" time="0.020"> <testcase name="TestFour" classname="package/name" time="0.020">
<failure message="Failed" type=""></failure> <failure message="Failed"></failure>
</testcase> </testcase>
<testcase classname="name" name="TestFour/#00" time="0.000"> <testcase name="TestFour/#00" classname="package/name" time="0.000">
<failure message="Failed" type="">example.go:12: Expected abc OBTAINED:&#xA;&#x9;xyz&#xA;example.go:123: Expected and obtained are different.</failure> <failure message="Failed"><![CDATA[example.go:12: Expected abc OBTAINED:
xyz
example.go:123: Expected and obtained are different.]]></failure>
</testcase> </testcase>
<testcase classname="name" name="TestFour/#01" time="0.000"> <testcase name="TestFour/#01" classname="package/name" time="0.000">
<skipped message="example.go:1234: Not supported yet."></skipped> <skipped message="example.go:1234: Not supported yet."></skipped>
</testcase> </testcase>
<testcase classname="name" name="TestFour/#02" time="0.000"></testcase> <testcase name="TestFour/#02" classname="package/name" time="0.000"></testcase>
<testcase classname="name" name="TestFive" time="0.000"> <testcase name="TestFive" classname="package/name" time="0.000">
<skipped message="example.go:1392: Not supported yet."></skipped> <skipped message="example.go:1392: Not supported yet."></skipped>
</testcase> </testcase>
<testcase classname="name" name="TestSix" time="0.000"> <testcase name="TestSix" classname="package/name" time="0.000">
<failure message="Failed" type="">example.go:371: This should not fail!</failure> <failure message="Failed"><![CDATA[example.go:371: This should not fail!]]></failure>
</testcase> </testcase>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

@ -1,39 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="5" errors="3"> <testsuites tests="5" errors="3">
<testsuite tests="1" failures="0" errors="0" time="0.100" name="package/name/passing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/passing1" tests="1" failures="0" errors="0" hostname="hostname" time="0.100" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="passing1" name="TestA" time="0.100"></testcase> <testcase name="TestA" classname="package/name/passing1" time="0.100"></testcase>
</testsuite> </testsuite>
<testsuite tests="1" failures="0" errors="0" time="0.100" name="package/name/passing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/passing2" tests="1" failures="0" errors="0" hostname="hostname" time="0.100" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="passing2" name="TestB" time="0.100"></testcase> <testcase name="TestB" classname="package/name/passing2" time="0.100"></testcase>
</testsuite> </testsuite>
<testsuite tests="1" failures="0" errors="1" time="0.000" name="package/name/failing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/failing1" tests="1" failures="0" errors="1" hostname="hostname" time="0.000" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="failing1" name="[build failed]" time="0.000"> <testcase name="[build failed]" classname="package/name/failing1" time="0.000">
<error message="Build error" type="">failing1/failing_test.go:15: undefined: x</error> <error message="Build error"><![CDATA[failing1/failing_test.go:15: undefined: x]]></error>
</testcase> </testcase>
</testsuite> </testsuite>
<testsuite tests="1" failures="0" errors="1" time="0.000" name="package/name/failing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/failing2" tests="1" failures="0" errors="1" hostname="hostname" time="0.000" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="failing2" name="[build failed]" time="0.000"> <testcase name="[build failed]" classname="package/name/failing2" time="0.000">
<error message="Build error" type="">failing2/another_failing_test.go:20: undefined: y</error> <error message="Build error"><![CDATA[failing2/another_failing_test.go:20: undefined: y]]></error>
</testcase> </testcase>
</testsuite> </testsuite>
<testsuite tests="1" failures="0" errors="1" time="0.000" name="package/name/setupfailing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/setupfailing1" tests="1" failures="0" errors="1" hostname="hostname" time="0.000" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="setupfailing1" name="[setup failed]" time="0.000"> <testcase name="[setup failed]" classname="package/name/setupfailing1" time="0.000">
<error message="Build error" type="">setupfailing1/failing_test.go:4: cannot find package &#34;other/package&#34; in any of:&#xA;&#x9;/path/vendor (vendor tree)&#xA;&#x9;/path/go/root (from $GOROOT)&#xA;&#x9;/path/go/path (from $GOPATH)</error> <error message="Build error"><![CDATA[setupfailing1/failing_test.go:4: cannot find package "other/package" in any of:
/path/vendor (vendor tree)
/path/go/root (from $GOROOT)
/path/go/path (from $GOPATH)]]></error>
</testcase> </testcase>
</testsuite> </testsuite>
</testsuites> </testsuites>

17
testdata/131-report.xml vendored Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="9">
<testsuite name="github.com/jstemmer/test/whitespace" tests="9" failures="0" errors="0" hostname="hostname" time="0.001" timestamp="2022-01-01T00:00:00Z">
<properties>
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="TestFlat" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestWithSpace" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestWithTab" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestWithNewlinesFlat" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestFlat" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestWithSpace" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestWithTab" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
<testcase name="TestSubTests/TestWithNewlinesFlat" classname="github.com/jstemmer/test/whitespace" time="0.000"></testcase>
</testsuite>
</testsuites>

View File

@ -1,19 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" errors="2"> <testsuites tests="2" errors="2">
<testsuite tests="1" failures="0" errors="1" time="0.003" name="package/panic" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/panic" tests="1" failures="0" errors="1" hostname="hostname" time="0.003" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="panic" name="Failure" time="0.000"> <testcase name="Failure" classname="package/panic" time="0.000">
<error message="Run error" type="">panic: init&#xA;stacktrace</error> <error message="Run error"><![CDATA[panic: init
stacktrace]]></error>
</testcase> </testcase>
</testsuite> </testsuite>
<testsuite tests="1" failures="0" errors="1" time="0.003" name="package/panic2" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/panic2" tests="1" failures="0" errors="1" hostname="hostname" time="0.003" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="panic2" name="Failure" time="0.000"> <testcase name="Failure" classname="package/panic2" time="0.000">
<error message="Run error" type="">panic: init&#xA;stacktrace</error> <error message="Run error"><![CDATA[panic: init
stacktrace]]></error>
</testcase> </testcase>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

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

View File

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

View File

@ -1,11 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1" failures="1"> <testsuites tests="1" failures="1">
<testsuite tests="1" failures="1" errors="0" time="0.015" name="race_test" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="race_test" tests="1" failures="1" errors="0" hostname="hostname" time="0.015" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="race_test" name="TestRace" time="0.000"> <testcase name="TestRace" classname="race_test" time="0.000">
<failure message="Failed" type="">test output&#xA;2 0xc4200153d0&#xA;==================&#xA;WARNING: DATA RACE&#xA;Write at 0x00c4200153d0 by goroutine 7:&#xA; race_test.TestRace.func1()&#xA; race_test.go:13 +0x3b&#xA;&#xA;Previous write at 0x00c4200153d0 by goroutine 6:&#xA; race_test.TestRace()&#xA; race_test.go:15 +0x136&#xA; testing.tRunner()&#xA; /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107&#xA;&#xA;Goroutine 7 (running) created at:&#xA; race_test.TestRace()&#xA; race_test.go:14 +0x125&#xA; testing.tRunner()&#xA; /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107&#xA;&#xA;Goroutine 6 (running) created at:&#xA; testing.(*T).Run()&#xA; /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:697 +0x543&#xA; testing.runTests.func1()&#xA; /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:882 +0xaa&#xA; testing.tRunner()&#xA; /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107&#xA; testing.runTests()&#xA; /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:888 +0x4e0&#xA; testing.(*M).Run()&#xA; /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:822 +0x1c3&#xA; main.main()&#xA; _test/_testmain.go:52 +0x20f&#xA;==================&#xA;testing.go:610: race detected during execution of test</failure> <failure message="Failed"><![CDATA[test output
2 0xc4200153d0
==================
WARNING: DATA RACE
Write at 0x00c4200153d0 by goroutine 7:
race_test.TestRace.func1()
race_test.go:13 +0x3b
Previous write at 0x00c4200153d0 by goroutine 6:
race_test.TestRace()
race_test.go:15 +0x136
testing.tRunner()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107
Goroutine 7 (running) created at:
race_test.TestRace()
race_test.go:14 +0x125
testing.tRunner()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107
Goroutine 6 (running) created at:
testing.(*T).Run()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:697 +0x543
testing.runTests.func1()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:882 +0xaa
testing.tRunner()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107
testing.runTests()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:888 +0x4e0
testing.(*M).Run()
/usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:822 +0x1c3
main.main()
_test/_testmain.go:52 +0x20f
==================
testing.go:610: race detected during execution of test]]></failure>
</testcase> </testcase>
<system-out><![CDATA[exit status 1]]></system-out> <system-out><![CDATA[exit status 1]]></system-out>
</testsuite> </testsuite>

View File

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

View File

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

View File

@ -1,17 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3" failures="3"> <testsuites tests="3" failures="3">
<testsuite tests="3" failures="3" errors="0" time="3.010" name="pkg/parallel" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="pkg/parallel" tests="3" failures="3" errors="0" hostname="hostname" time="3.010" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="parallel" name="FirstTest" time="2.000"> <testcase name="FirstTest" classname="pkg/parallel" time="2.000">
<failure message="Failed" type="">Message from first&#xA;Supplemental from first&#xA;parallel_test.go:14: FirstTest error</failure> <failure message="Failed"><![CDATA[Message from first
Supplemental from first
parallel_test.go:14: FirstTest error]]></failure>
</testcase> </testcase>
<testcase classname="parallel" name="SecondTest" time="1.000"> <testcase name="SecondTest" classname="pkg/parallel" time="1.000">
<failure message="Failed" type="">Message from second&#xA;parallel_test.go:23: SecondTest error</failure> <failure message="Failed"><![CDATA[Message from second
parallel_test.go:23: SecondTest error]]></failure>
</testcase> </testcase>
<testcase classname="parallel" name="ThirdTest" time="0.010"> <testcase name="ThirdTest" classname="pkg/parallel" time="0.010">
<failure message="Failed" type="">Message from third&#xA;parallel_test.go:32: ThirdTest error</failure> <failure message="Failed"><![CDATA[Message from third
parallel_test.go:32: ThirdTest error]]></failure>
</testcase> </testcase>
<system-out><![CDATA[exit status 1]]></system-out> <system-out><![CDATA[exit status 1]]></system-out>
</testsuite> </testsuite>

View File

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

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2"> <testsuites tests="2">
<testsuite tests="2" failures="0" errors="0" time="3.212" name="package/basic" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/basic" tests="2" failures="0" errors="0" hostname="hostname" time="3.212" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="basic" name="BenchmarkParse" time="0.000000604"></testcase> <testcase name="BenchmarkParse" classname="package/basic" time="0.000000604"></testcase>
<testcase classname="basic" name="BenchmarkReadingList" time="0.000001425"></testcase> <testcase name="BenchmarkReadingList" classname="package/basic" time="0.000001425"></testcase>
<system-out><![CDATA[goos: darwin <system-out><![CDATA[goos: darwin
goarch: amd64 goarch: amd64
pkg: code.internal/state]]></system-out> pkg: code.internal/state]]></system-out>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2"> <testsuites tests="2">
<testsuite tests="2" failures="0" errors="0" time="9.415" name="package/one" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/one" tests="2" failures="0" errors="0" hostname="hostname" time="9.415" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="one" name="BenchmarkIpsHistoryInsert" time="0.000052568"></testcase> <testcase name="BenchmarkIpsHistoryInsert" classname="package/one" time="0.000052568"></testcase>
<testcase classname="one" name="BenchmarkIpsHistoryLookup" time="0.000015208"></testcase> <testcase name="BenchmarkIpsHistoryLookup" classname="package/one" time="0.000015208"></testcase>
<system-out><![CDATA[goos: darwin <system-out><![CDATA[goos: darwin
goarch: amd64 goarch: amd64
pkg: code.internal/state]]></system-out> pkg: code.internal/state]]></system-out>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="6"> <testsuites tests="6">
<testsuite tests="6" failures="0" errors="0" time="1.382" name="package3/baz" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package3/baz" tests="6" failures="0" errors="0" hostname="hostname" time="1.382" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="baz" name="TestNew" time="0.000"></testcase> <testcase name="TestNew" classname="package3/baz" time="0.000"></testcase>
<testcase classname="baz" name="TestNew/no" time="0.000"></testcase> <testcase name="TestNew/no" classname="package3/baz" time="0.000"></testcase>
<testcase classname="baz" name="TestNew/normal" time="0.000"></testcase> <testcase name="TestNew/normal" classname="package3/baz" time="0.000"></testcase>
<testcase classname="baz" name="TestWriteThis" time="0.000"></testcase> <testcase name="TestWriteThis" classname="package3/baz" time="0.000"></testcase>
<testcase classname="baz" name="BenchmarkDeepMerge" time="0.000002611"></testcase> <testcase name="BenchmarkDeepMerge" classname="package3/baz" time="0.000002611"></testcase>
<testcase classname="baz" name="BenchmarkNext" time="0.000000100"></testcase> <testcase name="BenchmarkNext" classname="package3/baz" time="0.000000100"></testcase>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

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

View File

@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="6"> <testsuites tests="6">
<testsuite tests="2" failures="0" errors="0" time="7.267" name="mycode/common" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="mycode/common" tests="2" failures="0" errors="0" hostname="hostname" time="7.267" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="common" name="BenchmarkParse" time="0.000001591"></testcase> <testcase name="BenchmarkParse" classname="mycode/common" time="0.000001591"></testcase>
<testcase classname="common" name="BenchmarkNewTask" time="0.000000391"></testcase> <testcase name="BenchmarkNewTask" classname="mycode/common" time="0.000000391"></testcase>
<system-out><![CDATA[pkg: mycode/common]]></system-out> <system-out><![CDATA[pkg: mycode/common]]></system-out>
</testsuite> </testsuite>
<testsuite tests="4" failures="0" errors="0" time="47.084" name="mycode/benchmarks/channels" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="mycode/benchmarks/channels" tests="4" failures="0" errors="0" hostname="hostname" time="47.084" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="channels" name="BenchmarkFanout/Channel/10" time="0.000004673"></testcase> <testcase name="BenchmarkFanout/Channel/10" classname="mycode/benchmarks/channels" time="0.000004673"></testcase>
<testcase classname="channels" name="BenchmarkFanout/Channel/100" time="0.000024965"></testcase> <testcase name="BenchmarkFanout/Channel/100" classname="mycode/benchmarks/channels" time="0.000024965"></testcase>
<testcase classname="channels" name="BenchmarkFanout/Channel/1000" time="0.000195672"></testcase> <testcase name="BenchmarkFanout/Channel/1000" classname="mycode/benchmarks/channels" time="0.000195672"></testcase>
<testcase classname="channels" name="BenchmarkFanout/Channel/10000" time="0.002410200"></testcase> <testcase name="BenchmarkFanout/Channel/10000" classname="mycode/benchmarks/channels" time="0.002410200"></testcase>
<system-out><![CDATA[pkg: mycode/benchmarks/channels]]></system-out> <system-out><![CDATA[pkg: mycode/benchmarks/channels]]></system-out>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="3"> <testsuites tests="3">
<testsuite tests="3" failures="0" errors="0" time="4.344" name="really/small" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="really/small" tests="3" failures="0" errors="0" hostname="hostname" time="4.344" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="small" name="BenchmarkItsy" time="0.000000045"></testcase> <testcase name="BenchmarkItsy" classname="really/small" time="0.000000045"></testcase>
<testcase classname="small" name="BenchmarkTeeny" time="0.000000002"></testcase> <testcase name="BenchmarkTeeny" classname="really/small" time="0.000000002"></testcase>
<testcase classname="small" name="BenchmarkWeeny" time="0.000000000"></testcase> <testcase name="BenchmarkWeeny" classname="really/small" time="0.000000000"></testcase>
<system-out><![CDATA[goos: darwin <system-out><![CDATA[goos: darwin
goarch: amd64 goarch: amd64
pkg: really/small]]></system-out> pkg: really/small]]></system-out>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1"> <testsuites tests="1">
<testsuite tests="1" failures="0" errors="0" time="9.467" name="single/cpu" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="single/cpu" tests="1" failures="0" errors="0" hostname="hostname" time="9.467" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="cpu" name="BenchmarkRing" time="0.000000074"></testcase> <testcase name="BenchmarkRing" classname="single/cpu" time="0.000000074"></testcase>
<system-out><![CDATA[pkg: single/cpu]]></system-out> <system-out><![CDATA[pkg: single/cpu]]></system-out>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="1"> <testsuites tests="1">
<testsuite tests="1" failures="0" errors="0" time="1.522" name="sixteen/cpu" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="sixteen/cpu" tests="1" failures="0" errors="0" hostname="hostname" time="1.522" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="cpu" name="BenchmarkRingaround" time="0.000013571"></testcase> <testcase name="BenchmarkRingaround" classname="sixteen/cpu" time="0.000013571"></testcase>
<system-out><![CDATA[pkg: sixteen/cpu]]></system-out> <system-out><![CDATA[pkg: sixteen/cpu]]></system-out>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

@ -1,43 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="17" failures="9"> <testsuites tests="17" failures="9">
<testsuite tests="17" failures="9" errors="0" time="4.567" name="package/name1" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name1" tests="17" failures="9" errors="0" hostname="hostname" time="4.567" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="name1" name="TestFailWithStdoutAndTestOutput" time="0.100"> <testcase name="TestFailWithStdoutAndTestOutput" classname="package/name1" time="0.100">
<failure message="Failed" type="">multi&#xA;line&#xA;stdout&#xA;single-line stdout&#xA;example_test.go:13: single-line error&#xA;example_test.go:14: multi&#xA; line&#xA; error</failure> <failure message="Failed"><![CDATA[multi
line
stdout
single-line stdout
example_test.go:13: single-line error
example_test.go:14: multi
line
error]]></failure>
</testcase> </testcase>
<testcase classname="name1" name="TestFailWithStdoutAndNoTestOutput" time="0.150"> <testcase name="TestFailWithStdoutAndNoTestOutput" classname="package/name1" time="0.150">
<failure message="Failed" type="">multi&#xA;line&#xA;stdout&#xA;single-line stdout</failure> <failure message="Failed"><![CDATA[multi
line
stdout
single-line stdout]]></failure>
</testcase> </testcase>
<testcase classname="name1" name="TestFailWithTestOutput" time="0.200"> <testcase name="TestFailWithTestOutput" classname="package/name1" time="0.200">
<failure message="Failed" type="">example_test.go:26: single-line error&#xA;example_test.go:27: multi&#xA; line&#xA; error</failure> <failure message="Failed"><![CDATA[example_test.go:26: single-line error
example_test.go:27: multi
line
error]]></failure>
</testcase> </testcase>
<testcase classname="name1" name="TestFailWithNoTestOutput" time="0.250"> <testcase name="TestFailWithNoTestOutput" classname="package/name1" time="0.250">
<failure message="Failed" type=""></failure> <failure message="Failed"></failure>
</testcase> </testcase>
<testcase classname="name1" name="TestPassWithStdoutAndTestOutput" time="0.300"></testcase> <testcase name="TestPassWithStdoutAndTestOutput" classname="package/name1" time="0.300"></testcase>
<testcase classname="name1" name="TestPassWithStdoutAndNoTestOutput" time="0.350"></testcase> <testcase name="TestPassWithStdoutAndNoTestOutput" classname="package/name1" time="0.350"></testcase>
<testcase classname="name1" name="TestPassWithTestOutput" time="0.400"></testcase> <testcase name="TestPassWithTestOutput" classname="package/name1" time="0.400"></testcase>
<testcase classname="name1" name="TestPassWithNoTestOutput" time="0.500"></testcase> <testcase name="TestPassWithNoTestOutput" classname="package/name1" time="0.500"></testcase>
<testcase classname="name1" name="TestSubtests" time="2.270"> <testcase name="TestSubtests" classname="package/name1" time="2.270">
<failure message="Failed" type=""></failure> <failure message="Failed"></failure>
</testcase> </testcase>
<testcase classname="name1" name="TestSubtests/TestFailWithStdoutAndTestOutput" time="0.100"> <testcase name="TestSubtests/TestFailWithStdoutAndTestOutput" classname="package/name1" time="0.100">
<failure message="Failed" type="">1 multi&#xA;line&#xA;stdout&#xA;1 single-line stdout&#xA;example_test.go:65: 1 single-line error&#xA;example_test.go:66: 1 multi&#xA; line&#xA; error</failure> <failure message="Failed"><![CDATA[1 multi
line
stdout
1 single-line stdout
example_test.go:65: 1 single-line error
example_test.go:66: 1 multi
line
error]]></failure>
</testcase> </testcase>
<testcase classname="name1" name="TestSubtests/TestFailWithStdoutAndNoTestOutput" time="0.150"> <testcase name="TestSubtests/TestFailWithStdoutAndNoTestOutput" classname="package/name1" time="0.150">
<failure message="Failed" type="">2 multi&#xA;line&#xA;stdout&#xA;2 single-line stdout</failure> <failure message="Failed"><![CDATA[2 multi
line
stdout
2 single-line stdout]]></failure>
</testcase> </testcase>
<testcase classname="name1" name="TestSubtests/TestFailWithTestOutput" time="0.200"> <testcase name="TestSubtests/TestFailWithTestOutput" classname="package/name1" time="0.200">
<failure message="Failed" type="">example_test.go:78: 3 single-line error&#xA;example_test.go:79: 3 multi&#xA; line&#xA; error</failure> <failure message="Failed"><![CDATA[example_test.go:78: 3 single-line error
example_test.go:79: 3 multi
line
error]]></failure>
</testcase> </testcase>
<testcase classname="name1" name="TestSubtests/TestFailWithNoTestOutput" time="0.250"> <testcase name="TestSubtests/TestFailWithNoTestOutput" classname="package/name1" time="0.250">
<failure message="Failed" type=""></failure> <failure message="Failed"></failure>
</testcase> </testcase>
<testcase classname="name1" name="TestSubtests/TestPassWithStdoutAndTestOutput" time="0.300"></testcase> <testcase name="TestSubtests/TestPassWithStdoutAndTestOutput" classname="package/name1" time="0.300"></testcase>
<testcase classname="name1" name="TestSubtests/TestPassWithStdoutAndNoTestOutput" time="0.350"></testcase> <testcase name="TestSubtests/TestPassWithStdoutAndNoTestOutput" classname="package/name1" time="0.350"></testcase>
<testcase classname="name1" name="TestSubtests/TestPassWithTestOutput" time="0.400"></testcase> <testcase name="TestSubtests/TestPassWithTestOutput" classname="package/name1" time="0.400"></testcase>
<testcase classname="name1" name="TestSubtests/TestPassWithNoTestOutput" time="0.500"></testcase> <testcase name="TestSubtests/TestPassWithNoTestOutput" classname="package/name1" time="0.500"></testcase>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

@ -1,39 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="5" errors="3"> <testsuites tests="5" errors="3">
<testsuite tests="1" failures="0" errors="0" time="0.100" name="package/name/passing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/passing1" tests="1" failures="0" errors="0" hostname="hostname" time="0.100" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="passing1" name="TestA" time="0.100"></testcase> <testcase name="TestA" classname="package/name/passing1" time="0.100"></testcase>
</testsuite> </testsuite>
<testsuite tests="1" failures="0" errors="0" time="0.100" name="package/name/passing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/passing2" tests="1" failures="0" errors="0" hostname="hostname" time="0.100" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="passing2" name="TestB" time="0.100"></testcase> <testcase name="TestB" classname="package/name/passing2" time="0.100"></testcase>
</testsuite> </testsuite>
<testsuite tests="1" failures="0" errors="1" time="0.000" name="package/name/failing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/failing1" tests="1" failures="0" errors="1" hostname="hostname" time="0.000" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="failing1" name="[build failed]" time="0.000"> <testcase name="[build failed]" classname="package/name/failing1" time="0.000">
<error message="Build error" type="">failing1/failing_test.go:15: undefined: x</error> <error message="Build error"><![CDATA[failing1/failing_test.go:15: undefined: x]]></error>
</testcase> </testcase>
</testsuite> </testsuite>
<testsuite tests="1" failures="0" errors="1" time="0.000" name="package/name/failing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/failing2" tests="1" failures="0" errors="1" hostname="hostname" time="0.000" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="failing2" name="[build failed]" time="0.000"> <testcase name="[build failed]" classname="package/name/failing2" time="0.000">
<error message="Build error" type="">failing2/another_failing_test.go:20: undefined: y</error> <error message="Build error"><![CDATA[failing2/another_failing_test.go:20: undefined: y]]></error>
</testcase> </testcase>
</testsuite> </testsuite>
<testsuite tests="1" failures="0" errors="1" time="0.000" name="package/name/setupfailing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="package/name/setupfailing1" tests="1" failures="0" errors="1" hostname="hostname" time="0.000" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="setupfailing1" name="[setup failed]" time="0.000"> <testcase name="[setup failed]" classname="package/name/setupfailing1" time="0.000">
<error message="Build error" type="">setupfailing1/failing_test.go:4: cannot find package &#34;other/package&#34; in any of:&#xA;&#x9;/path/vendor (vendor tree)&#xA;&#x9;/path/go/root (from $GOROOT)&#xA;&#x9;/path/go/path (from $GOPATH)</error> <error message="Build error"><![CDATA[setupfailing1/failing_test.go:4: cannot find package "other/package" in any of:
/path/vendor (vendor tree)
/path/go/root (from $GOROOT)
/path/go/path (from $GOPATH)]]></error>
</testcase> </testcase>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2" errors="1"> <testsuites tests="2" errors="1">
<testsuite tests="2" failures="0" errors="1" time="0.005" name="github.com/jstemmer/test/failedsummary" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="github.com/jstemmer/test/failedsummary" tests="2" failures="0" errors="1" hostname="hostname" time="0.005" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="failedsummary" name="TestOne" time="0.000"></testcase> <testcase name="TestOne" classname="github.com/jstemmer/test/failedsummary" time="0.000"></testcase>
<testcase classname="failedsummary" name="Failure" time="0.000"> <testcase name="Failure" classname="github.com/jstemmer/test/failedsummary" time="0.000">
<error message="Run error" type="">panic: panic</error> <error message="Run error"><![CDATA[panic: panic]]></error>
</testcase> </testcase>
</testsuite> </testsuite>
</testsuites> </testsuites>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="2"> <testsuites tests="2">
<testsuite tests="2" failures="0" errors="0" time="83.202" name="compress/flate" hostname="hostname" timestamp="2022-01-01T00:00:00Z"> <testsuite name="compress/flate" tests="2" failures="0" errors="0" hostname="hostname" time="83.202" timestamp="2022-01-01T00:00:00Z">
<properties> <properties>
<property name="go.version" value="1.0"></property> <property name="go.version" value="1.0"></property>
</properties> </properties>
<testcase classname="flate" name="BenchmarkDecode/Digits/Huffman/1e4" time="0.000104427"></testcase> <testcase name="BenchmarkDecode/Digits/Huffman/1e4" classname="compress/flate" time="0.000104427"></testcase>
<testcase classname="flate" name="BenchmarkEncode/Digits/Huffman/1e4" time="0.000028334"></testcase> <testcase name="BenchmarkEncode/Digits/Huffman/1e4" classname="compress/flate" time="0.000028334"></testcase>
<system-out><![CDATA[goos: linux <system-out><![CDATA[goos: linux
goarch: amd64 goarch: amd64
pkg: compress/flate]]></system-out> pkg: compress/flate]]></system-out>

View File

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

129
testdata/generate-golden.go vendored Normal file
View File

@ -0,0 +1,129 @@
//go:generate go run generate-golden.go -w
package main
import (
"encoding/xml"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"time"
"github.com/jstemmer/go-junit-report/v2/pkg/junit"
"github.com/jstemmer/go-junit-report/v2/pkg/parser/gotest"
)
var verbose bool
type Settings struct {
skipXMLHeader bool
packageName string
}
var fileSettings = map[string]Settings{
"05-no_xml_header.txt": {skipXMLHeader: true},
"06-mixed.txt": {skipXMLHeader: true},
"07-compiled_test.txt": {packageName: "test/package"},
}
func main() {
var writeFiles bool
flag.BoolVar(&verbose, "v", false, "verbose logging")
flag.BoolVar(&writeFiles, "w", false, "write output xml files")
flag.Parse()
files, err := filepath.Glob("*.txt")
if err != nil {
exitf("error listing files: %v\n", err)
}
for _, file := range files {
outName := outputName(file)
if err := createReportFromInput(file, outName, writeFiles); err != nil {
logf("error creating report: %v\n", err)
continue
}
if writeFiles {
logf("report written to %s\n", outName)
}
}
}
func logf(msg string, args ...interface{}) {
if verbose {
fmt.Printf(msg, args...)
}
}
func exitf(msg string, args ...interface{}) {
fmt.Fprintf(os.Stderr, msg, args...)
os.Exit(1)
}
func outputName(input string) string {
dir, name := filepath.Split(input)
var out string
if idx := strings.IndexByte(name, '-'); idx > -1 {
out = input[:idx+1] + "report.xml"
} else {
out = strings.TrimSuffix(name, filepath.Ext(name)) + "report.xml"
}
return filepath.Join(dir, out)
}
func createReportFromInput(inputFile, outputFile string, write bool) error {
in, err := os.Open(inputFile)
if err != nil {
return err
}
defer in.Close()
out := io.Discard
if write {
f, err := os.Create(outputFile)
if err != nil {
return err
}
defer f.Close()
out = f
}
return writeReport(in, out, fileSettings[inputFile])
}
func writeReport(in io.Reader, out io.Writer, settings Settings) error {
parser := gotest.New(
gotest.PackageName(settings.packageName),
gotest.TimestampFunc(func() time.Time {
return time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC)
}),
)
report, err := parser.Parse(in)
if err != nil {
return err
}
for i := range report.Packages {
report.Packages[i].SetProperty("go.version", "1.0")
}
testsuites := junit.CreateFromReport(report, "hostname")
if !settings.skipXMLHeader {
if _, err := fmt.Fprintf(out, xml.Header); err != nil {
return err
}
}
enc := xml.NewEncoder(out)
enc.Indent("", "\t")
if err := enc.Encode(testsuites); err != nil {
return err
}
if err := enc.Flush(); err != nil {
return err
}
_, err = fmt.Fprintf(out, "\n")
return err
}