go-junit-report icon indicating copy to clipboard operation
go-junit-report copied to clipboard

Customize line ending in report

Open fpawel opened this issue 4 years ago • 1 comments

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&#xA;        goroutine 76 [running]:&#xA;        runtime/debug.Stack(0xc00006ab48, 0xd30260, 0x10707b0)&#xA;        github.com/stretchr/testify/suite.failOnPanic(0xc00012e900)&#xA;        panic(0xd30260, 0x10707b0)&#xA;        szs-op/zfs.(*ZpoolTestSuite).SetupTest(0xc000767e00)&#xA;        github.com/stretchr/testify/suite.Run.func1(0xc00012e900)&#xA;        testing.tRunner(0xc00012e900, 0xc0005a9290)&#xA;        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&#xA;        goroutine 77 [running]:&#xA;        runtime/debug.Stack(0xc00006ab48, 0xd30260, 0x10707b0)&#xA;        github.com/stretchr/testify/suite.failOnPanic(0xc00012ea80)&#xA;        panic(0xd30260, 0x10707b0)&#xA;        szs-op/zfs.(*ZpoolTestSuite).SetupTest(0xc000767e00)&#xA;        github.com/stretchr/testify/suite.Run.func1(0xc00012ea80)&#xA;        testing.tRunner(0xc00012ea80, 0xc0005a9320)&#xA;        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&#xA;        goroutine 78 [running]:&#xA;        runtime/debug.Stack(0xc00006ab48, 0xd30260, 0x10707b0)&#xA;        github.com/stretchr/testify/suite.failOnPanic(0xc00012ec00)&#xA;        panic(0xd30260, 0x10707b0)&#xA;        szs-op/zfs.(*ZpoolTestSuite).SetupTest(0xc000767e00)&#xA;        github.com/stretchr/testify/suite.Run.func1(0xc00012ec00)&#xA;        testing.tRunner(0xc00012ec00, 0xc0005a93b0)&#xA;        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&#xA;        goroutine 79 [running]:&#xA;        runtime/debug.Stack(0xc00006ab48, 0xd30260, 0x10707b0)&#xA;        github.com/stretchr/testify/suite.failOnPanic(0xc00012ed80)&#xA;        panic(0xd30260, 0x10707b0)&#xA;        szs-op/zfs.(*ZpoolTestSuite).SetupTest(0xc000767e00)&#xA;        github.com/stretchr/testify/suite.Run.func1(0xc00012ed80)&#xA;        testing.tRunner(0xc00012ed80, 0xc0005a9440)&#xA;        created by testing.(*T).Run</failure>
		</testcase>

is shown like this image I replaced word "&#xA;" with word "&#xD;&#xA;" in the report, as a result I got the expected picture image 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

fpawel avatar Aug 24 '21 08:08 fpawel

Are you running Jenkins on a Windows server, or is this something specific to Jenkins itself?

jstemmer avatar Feb 24 '22 22:02 jstemmer