=== RUN TestSampleSuccessful
--- PASS: TestSampleSuccessful (0.00s)
=== RUN TestSampleFail
--- FAIL: TestSampleFail (0.00s)
Error Trace: samples_test.go:20
Error: Should be true
Messages: Should be true
=== RUN TestSampleSuite
=== RUN TestSampleSuite/TestSuiteSampleFail
=== RUN TestSampleSuite/TestSuiteSampleSuccessful
--- FAIL: TestSampleSuite (0.00s)
--- FAIL: TestSampleSuite/TestSuiteSampleFail (0.0
Error Trace: samplestest.go:28
Error: Should be true
Messages: Should be true
--- PASS: TestSampleSuite/TestSuiteSampleSuccessful (0.00s)
FAIL
exit status 1
FAIL /Users/Teodor/go2xunit_samples 0.016s
The output file generated by go2xunit is:
<?xml version="1.0" encoding="UTF-8"?>
Error Trace: samples_test.go:20
Error: Should be true
Messages: Should be true]]>
As you can see there are <![CDATA[]]> tags instead of error message.
The bug is caused by adding the error message to the curTest instead of adding it to the previous test.
Hello,
I think I found a bug for go 1.7.5. Here is test file:
` package go2xunitsample import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" )
type SampleTestSuite struct { suite.Suite } func TestSampleSuccessful(t testing.T) { assert.True(t, true, "Should be true") } func TestSampleFail(t testing.T) { assert.True(t, false, "Should be true") } func (suite SampleTestSuite) TestSuiteSampleSuccessful() { suite.True(true, "Should be true") } func (suite SampleTestSuite) TestSuiteSampleFail() { suite.True(false, "Should be true") } func TestSampleSuite(t *testing.T) { suite.Run(t, new(SampleTestSuite)) }`
For this case the result output is:
=== RUN TestSampleSuccessful --- PASS: TestSampleSuccessful (0.00s) === RUN TestSampleFail --- FAIL: TestSampleFail (0.00s) Error Trace: samples_test.go:20 Error: Should be true Messages: Should be true === RUN TestSampleSuite === RUN TestSampleSuite/TestSuiteSampleFail === RUN TestSampleSuite/TestSuiteSampleSuccessful --- FAIL: TestSampleSuite (0.00s) --- FAIL: TestSampleSuite/TestSuiteSampleFail (0.0 Error Trace: samplestest.go:28 Error: Should be true Messages: Should be true --- PASS: TestSampleSuite/TestSuiteSampleSuccessful (0.00s) FAIL exit status 1 FAIL /Users/Teodor/go2xunit_samples 0.016s
The output file generated by go2xunit is: <?xml version="1.0" encoding="UTF-8"?>
As you can see there are <![CDATA[]]> tags instead of error message. The bug is caused by adding the error message to the curTest instead of adding it to the previous test.
WDYT ?