gfoidl / trx2junit

Transforms XML from trx-Testresults to JUnit-Testresults / trx to JUnit XML and the other way round
MIT License
70 stars 17 forks source link

trx2junit generates invalid output (field time) (according to surefire schema) #57

Closed LukeOwlclaw closed 5 years ago

LukeOwlclaw commented 5 years ago

Summary

trx2junit generates output like:

  <testsuite name="MyTest" hostname="XXX" package=".NET Core" id="0" tests="1" failures="0" errors="0" skipped="0" time="77.541159" timestamp="2019-08-22T16:23:13">

The time field uses lots of decimal places.

SUREFIRE_TIME allows at most 3.

It would be awesome to comply with the surefire definition for compatibility reasons. The needed change is easy and the loss of accuracy is neglectable. Do you agree?

xTestSuite.Add(new XAttribute("time"    , (decimal)_counters.Time.TotalSeconds));

would be to become

xTestSuite.Add(new XAttribute("time"    , ((decimal)_counters.Time.TotalSeconds).ToString("0.000")));

Further technical details

trx2junit-version: v1.2.2 Operating system: Windows 10

gfoidl commented 5 years ago

Do you agree?

Yes I agree 😃

~Do you want to submit a PR for this? (ideally including a test -- I think it's enough to validate against the xsd from SUREFIRE_TIME)~ (Edit: I'm back in the office, will fix it).

gfoidl commented 4 years ago

For reference: https://issues.jenkins-ci.org/browse/JENKINS-59064 seems to be the root issue for this.