mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-07-04 21:12:53 -05:00
gtr: Handle end_test events without corresponding run_test event
When running `go test` without the `-v` flag, the output may not contain everything that we expect. For example, no output is generated for passing tests. Even for a failing test the output does not contain a `=== RUN` line. Currently, this resulted in us ignoring the test result since we couldn't find an existing test to assign this result to. We should however handle this situation gracefully, and just assume a test exists when only encountering a test result line. References #109
This commit is contained in:
14
testdata/13-report.xml
vendored
14
testdata/13-report.xml
vendored
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites tests="5" failures="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">
|
||||
<properties>
|
||||
<property name="go.version" value="1.0"></property>
|
||||
@ -12,28 +12,28 @@
|
||||
</properties>
|
||||
<testcase classname="passing2" name="TestB" time="0.100"></testcase>
|
||||
</testsuite>
|
||||
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/failing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
|
||||
<testsuite tests="1" failures="0" errors="1" 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>
|
||||
<testcase classname="failing1" name="[build failed]" time="0.000">
|
||||
<failure message="Failed" type="">failing1/failing_test.go:15: undefined: x</failure>
|
||||
<error message="Build error" type="">failing1/failing_test.go:15: undefined: x</error>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/failing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
|
||||
<testsuite tests="1" failures="0" errors="1" 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>
|
||||
<testcase classname="failing2" name="[build failed]" time="0.000">
|
||||
<failure message="Failed" type="">failing2/another_failing_test.go:20: undefined: y</failure>
|
||||
<error message="Build error" type="">failing2/another_failing_test.go:20: undefined: y</error>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/setupfailing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
|
||||
<testsuite tests="1" failures="0" errors="1" 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>
|
||||
<testcase classname="setupfailing1" name="[setup failed]" time="0.000">
|
||||
<failure message="Failed" type="">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)</failure>
|
||||
<error message="Build error" type="">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>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
10
testdata/14-report.xml
vendored
10
testdata/14-report.xml
vendored
@ -1,19 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<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">
|
||||
<properties>
|
||||
<property name="go.version" value="1.0"></property>
|
||||
</properties>
|
||||
<testcase classname="panic" name="Failure" time="0.000">
|
||||
<failure message="Failed" type="">panic: init
stacktrace</failure>
|
||||
<error message="Run error" type="">panic: init
stacktrace</error>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite tests="1" failures="1" errors="0" time="0.003" name="package/panic2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
|
||||
<testsuite tests="1" failures="0" errors="1" time="0.003" name="package/panic2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
|
||||
<properties>
|
||||
<property name="go.version" value="1.0"></property>
|
||||
</properties>
|
||||
<testcase classname="panic2" name="Failure" time="0.000">
|
||||
<failure message="Failed" type="">panic: init
stacktrace</failure>
|
||||
<error message="Run error" type="">panic: init
stacktrace</error>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
14
testdata/31-report.xml
vendored
14
testdata/31-report.xml
vendored
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites tests="5" failures="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">
|
||||
<properties>
|
||||
<property name="go.version" value="1.0"></property>
|
||||
@ -12,28 +12,28 @@
|
||||
</properties>
|
||||
<testcase classname="passing2" name="TestB" time="0.100"></testcase>
|
||||
</testsuite>
|
||||
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/failing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
|
||||
<testsuite tests="1" failures="0" errors="1" 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>
|
||||
<testcase classname="failing1" name="[build failed]" time="0.000">
|
||||
<failure message="Failed" type="">failing1/failing_test.go:15: undefined: x</failure>
|
||||
<error message="Build error" type="">failing1/failing_test.go:15: undefined: x</error>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/failing2" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
|
||||
<testsuite tests="1" failures="0" errors="1" 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>
|
||||
<testcase classname="failing2" name="[build failed]" time="0.000">
|
||||
<failure message="Failed" type="">failing2/another_failing_test.go:20: undefined: y</failure>
|
||||
<error message="Build error" type="">failing2/another_failing_test.go:20: undefined: y</error>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
<testsuite tests="1" failures="1" errors="0" time="0.000" name="package/name/setupfailing1" hostname="hostname" timestamp="2022-01-01T00:00:00Z">
|
||||
<testsuite tests="1" failures="0" errors="1" 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>
|
||||
<testcase classname="setupfailing1" name="[setup failed]" time="0.000">
|
||||
<failure message="Failed" type="">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)</failure>
|
||||
<error message="Build error" type="">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>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
6
testdata/32-report.xml
vendored
6
testdata/32-report.xml
vendored
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<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">
|
||||
<properties>
|
||||
<property name="go.version" value="1.0"></property>
|
||||
</properties>
|
||||
<testcase classname="failedsummary" name="TestOne" time="0.000"></testcase>
|
||||
<testcase classname="failedsummary" name="Failure" time="0.000">
|
||||
<failure message="Failed" type="">panic: panic</failure>
|
||||
<error message="Run error" type="">panic: panic</error>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
Reference in New Issue
Block a user