jstemmer / go-junit-report

Convert Go test output to JUnit XML
MIT License
776 stars 224 forks source link

Cant see test logs in junit result xml #108

Closed arthurvaverko-kaltura closed 2 years ago

arthurvaverko-kaltura commented 4 years ago

After tests are finished I can see the final result but I cannot see any log output using t.log method from the test ..

I ran the following go test -v ./... 2>&1 | go-junit-report > result.xml

I can see all my logs clearly when not piping into go-junit-report

But inside the xml there are none..

Is it supported ?

arthurvaverko-kaltura commented 4 years ago

I have browsed the code .. and saw that parser will grab the output .. then I saw this ..

https://github.com/jstemmer/go-junit-report/blob/984a47ca6b0a7d704c4b589852051b4d7865aa17/formatter/formatter.go#L102-L115

Why don't allow printing the output even during success ?

tp commented 4 years ago

I currently employ this long-winded workaround to see the raw logs on errors (I could also look into the reportXML; but the mails CI sends out contain the logs which for me are much faster to see what broke).

EXIT_CODE=0
go test -v ./... 2>&1 > testoutput.txt || EXIT_CODE=$?
cat testoutput.txt
cat testoutput.txt | go-junit-report > report.xml
exit $EXIT_CODE
jstemmer commented 2 years ago

This has been fixed in commit d2592490b6d4cb2fcad75df1df1a08b3bab121ac and will be included in the next v2 release.