junit: Include output in JUnit report for skipped and failed benchmarks

This commit is contained in:
Joël Stemmer 2022-06-13 00:34:20 +01:00
parent f1ad02b733
commit d05abd4130
3 changed files with 8 additions and 6 deletions

View File

@ -241,10 +241,12 @@ func createTestcaseForBenchmark(pkgName string, bm gtr.Benchmark) Testcase {
if bm.Result == gtr.Fail {
tc.Failure = &Result{
Message: "Failed",
Data: formatOutput(bm.Output, 0),
}
} else if bm.Result == gtr.Skip {
tc.Skipped = &Result{
Message: "Skipped",
Data: formatOutput(bm.Output, 0),
}
} else if len(bm.Output) > 0 {
tc.SystemOut = &Output{Data: formatOutput(bm.Output, 0)}

View File

@ -5,13 +5,13 @@
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="BenchmarkError" classname="package/name/benchfail" time="0.000">
<failure message="Failed"></failure>
<failure message="Failed"><![CDATA[ bench_test.go:6: error message]]></failure>
</testcase>
<testcase name="BenchmarkFatal" classname="package/name/benchfail" time="0.000">
<failure message="Failed"></failure>
<failure message="Failed"><![CDATA[ bench_test.go:10: fatal message]]></failure>
</testcase>
<testcase name="BenchmarkSkip" classname="package/name/benchfail" time="0.000">
<skipped message="Skipped"></skipped>
<skipped message="Skipped"><![CDATA[ bench_test.go:14: skip message]]></skipped>
</testcase>
<testcase name="Failure" classname="package/name/benchfail" time="0.000">
<error message="Runtime error"><![CDATA[goos: linux

View File

@ -5,13 +5,13 @@
<property name="go.version" value="1.0"></property>
</properties>
<testcase name="BenchmarkError" classname="package/name/benchfail" time="0.000">
<failure message="Failed"></failure>
<failure message="Failed"><![CDATA[ bench_test.go:6: error message]]></failure>
</testcase>
<testcase name="BenchmarkFatal" classname="package/name/benchfail" time="0.000">
<failure message="Failed"></failure>
<failure message="Failed"><![CDATA[ bench_test.go:10: fatal message]]></failure>
</testcase>
<testcase name="BenchmarkSkip" classname="package/name/benchfail" time="0.000">
<skipped message="Skipped"></skipped>
<skipped message="Skipped"><![CDATA[ bench_test.go:14: skip message]]></skipped>
</testcase>
<testcase name="Failure" classname="package/name/benchfail" time="0.000">
<error message="Runtime error"><![CDATA[goos: linux