go-junit-report
go-junit-report copied to clipboard
Customize line ending in report
HI!
in formatter/formatter.go 107 we have hardcoded lines separtor Contents: strings.Join(test.Output, "\n"),
In fact, this breaks the display of the stack trace of the failed tests in Jenkins.
F.e. this
<testcase classname="zfs" name="TestZpoolTestSuite" time="0.000">
<failure message="Failed" type=""></failure>
</testcase>
<testcase classname="zfs" name="TestZpoolTestSuite/TestGetFreeing_err" time="0.000">
<failure message="Failed" type=""> suite.go:63: test panicked: failed
 goroutine 76 [running]:
 runtime/debug.Stack(0xc00006ab48, 0xd30260, 0x10707b0)
 github.com/stretchr/testify/suite.failOnPanic(0xc00012e900)
 panic(0xd30260, 0x10707b0)
 szs-op/zfs.(*ZpoolTestSuite).SetupTest(0xc000767e00)
 github.com/stretchr/testify/suite.Run.func1(0xc00012e900)
 testing.tRunner(0xc00012e900, 0xc0005a9290)
 created by testing.(*T).Run</failure>
</testcase>
<testcase classname="zfs" name="TestZpoolTestSuite/TestGetFreeing_noOutput" time="0.000">
<failure message="Failed" type=""> suite.go:63: test panicked: failed
 goroutine 77 [running]:
 runtime/debug.Stack(0xc00006ab48, 0xd30260, 0x10707b0)
 github.com/stretchr/testify/suite.failOnPanic(0xc00012ea80)
 panic(0xd30260, 0x10707b0)
 szs-op/zfs.(*ZpoolTestSuite).SetupTest(0xc000767e00)
 github.com/stretchr/testify/suite.Run.func1(0xc00012ea80)
 testing.tRunner(0xc00012ea80, 0xc0005a9320)
 created by testing.(*T).Run</failure>
</testcase>
<testcase classname="zfs" name="TestZpoolTestSuite/TestGetFreeing_value" time="0.000">
<failure message="Failed" type=""> suite.go:63: test panicked: failed
 goroutine 78 [running]:
 runtime/debug.Stack(0xc00006ab48, 0xd30260, 0x10707b0)
 github.com/stretchr/testify/suite.failOnPanic(0xc00012ec00)
 panic(0xd30260, 0x10707b0)
 szs-op/zfs.(*ZpoolTestSuite).SetupTest(0xc000767e00)
 github.com/stretchr/testify/suite.Run.func1(0xc00012ec00)
 testing.tRunner(0xc00012ec00, 0xc0005a93b0)
 created by testing.(*T).Run</failure>
</testcase>
<testcase classname="zfs" name="TestZpoolTestSuite/TestGetFreeing_zero" time="0.000">
<failure message="Failed" type=""> suite.go:63: test panicked: failed
 goroutine 79 [running]:
 runtime/debug.Stack(0xc00006ab48, 0xd30260, 0x10707b0)
 github.com/stretchr/testify/suite.failOnPanic(0xc00012ed80)
 panic(0xd30260, 0x10707b0)
 szs-op/zfs.(*ZpoolTestSuite).SetupTest(0xc000767e00)
 github.com/stretchr/testify/suite.Run.func1(0xc00012ed80)
 testing.tRunner(0xc00012ed80, 0xc0005a9440)
 created by testing.(*T).Run</failure>
</testcase>
is shown like this
I replaced word "
" with word "
" in the report, as a result I got the expected picture
I see the solution to the problem in customizing the word added to the end of the line through the command line parameters. If you approve, I will offer an appropriate pull request
Are you running Jenkins on a Windows server, or is this something specific to Jenkins itself?