jstemmer / go-junit-report

Convert Go test output to JUnit XML
MIT License
764 stars 222 forks source link

Enhance multi-line support, use errors, optional sub-test wrapper ignore #112

Closed maneac closed 1 year ago

maneac commented 3 years ago

All changes are intended to be compliant with the JUnit schema found here: https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd

Several changes in one MR here, so to break it down:

Add flag to remove parent test from sub-tests (cases)

Issues: #72

If any sub-test within a function failed, the parent function is also logged as a failure. This can be misleading when viewing test results, so the option to ignore these parent lines has been added.

Enhance multi-line support

Issues: #80 #18

Only some test output was being written to the buffer, which overwrote anything set directly. Changed to always write to the buffer on output.

Populate "system-out" attribute with log results on PASS

Issues: #108

Uses the HTML string escaper to safely set the output.

Differentiate between "Errors" and "Failures"

Issues: #101 #105

If it goes wrong within a test (mismatched output, unexpected error returned, etc.), it's classified as a "Failure". The remainder of the cases fall into either build errors, or unexpected panics, which are both classified as "Errors".

zwiedmann-isp commented 3 years ago

Tried this out locally, defs improves the multiline support situation.

sja commented 3 years ago

These are great improvements? How can be helped to get this in?

zaquestion commented 3 years ago

@jstemmer Can you take a look?

gpevnev commented 2 years ago

@maneac amazing work, saved a lot of time debugging this for myself!

jstemmer commented 1 year ago

Thanks for taking the time to address the many outstanding issues that were present in the old version. I recently released v2.0.0, which I believe fixes all of the issues addressed here. I don't intend to maintain the old v1 branch, so won't be merging this PR.