tebeka / go2xunit

Convert "go test" output to xunit compatible (used in Jenkins/Hudson)
MIT License
162 stars 46 forks source link

Half of the testcase results missing in junit file #63

Closed fho closed 5 years ago

fho commented 5 years ago

I run

go test -v  -tags=unittest ./... 2>&1 > output.txt
go2xunit -input output.txt  -output junit.xml

for one of our applications.

The output.txt file contains results for 10 success and 1 failed testcase. The result from go2xunit contains only the result for 5 testcases. 6 testcase results are lost. I would expect that the junit file contains the same amout of testcases then the one printed by go test.

Files

output.txt junit.xml.txt

Versions

go version go1.11.2 linux/amd64 go2xunit 1.4.8

tebeka commented 5 years ago

Thanks for reporting. I'll have a look soon-ish.

tebeka commented 5 years ago

Try 1.4.9, should fix this

fho commented 5 years ago

@tebeka thanks for providing the fix!

I tested it with 1.4.9 and the output.txt from this issue report. I can confirm that now all tests are in the junit file. But 6/11 case are now listed in a testsuite with an empty name. This will make it hard to figure out to which application the testcase belongs if you junit files from multiple testruns are combined.

Any idea why the testsuite name is empty for 6/11 testcases?

<?xml version="1.0" encoding="UTF-8"?>

<testsuites>
  <testsuite name="sisu.sh/go/code/catalog/localizer" tests="5" errors="0" failures="1" skip="0">
    <testcase classname="sisu.sh/go/code/catalog/localizer" name="TestFail" time="0.00">

      <failure type="go.error" message="error">
        <![CDATA[    localizer_test.go:15: YO IM FAILING!]]>
      </failure>    </testcase>
    <testcase classname="sisu.sh/go/code/catalog/localizer" name="TestCurrencyMap" time="0.00">

    </testcase>
    <testcase classname="sisu.sh/go/code/catalog/localizer" name="TestCountryMap" time="0.00">

    </testcase>
    <testcase classname="sisu.sh/go/code/catalog/localizer" name="TestLanguagesByCountry" time="0.00">

    </testcase>
    <testcase classname="sisu.sh/go/code/catalog/localizer" name="TestCountryLanguageCombinations" time="0.00">

    </testcase>
  </testsuite>
  <testsuite name="" tests="6" errors="0" failures="0" skip="0">
    <testcase classname="" name="TestNameIsGeneratedCorrectly" time="0.00">

    </testcase>
    <testcase classname="" name="TestExtractNumericIds" time="0.00">

    </testcase>
    <testcase classname="" name="TestExtractStringIds" time="0.00">

    </testcase>
    <testcase classname="" name="TestIntSliceToStringSlice" time="0.00">

    </testcase>
    <testcase classname="" name="TestGetKeys" time="0.00">

    </testcase>
    <testcase classname="" name="TestProtoEnumToStringSlice" time="0.00">

    </testcase>
  </testsuite>
</testsuites>
tebeka commented 5 years ago

Thanks for checking. I'll have a look this week.

tebeka commented 5 years ago

Fixed in 1.4.10, thanks again

fho commented 5 years ago

@tebeka thank you for the fix :-)