ladariha/junitxml-to-javascript

the durationSec is always 0 for any testcase or testsuite

Closed this issue · 3 comments

I have a junit xml file with a few testsuite/ testcase, and in that xml file I can see the valid time for either testsuite or testcase, however after I run your parser, the result shows durationSec always as 0

Could you please share the xml file?

<?xml version="1.0" encoding="UTF-8" ?> <testsuites disabled="0" errors="0" failures="0" tests="5" time="25.932"> <testsuite name="send create request" timestamp="2019-04-05T17:53:47" hostname="localhost" time="25.127" errors="0" tests="2" skipped="0" disabled="0" failures="0"> <testcase classname="send create request" name="Then get status code 201" time="0.003" /> <testcase classname="send create request" name="And the response body" time="0.003" /> </testsuite> <testsuite name="send get request" timestamp="2019-04-05T17:54:12" hostname="localhost" time="0.439" errors="0" tests="2" skipped="0" disabled="0" failures="0"> <testcase classname="send get request" name="Then get status code 200" time="0.001" /> <testcase classname="send get request" name="And the response body" time="0.001" /> </testsuite> <testsuite name="send delete request" timestamp="2019-04-05T17:54:13" hostname="localhost" time="0.366" errors="0" tests="1" skipped="0" disabled="0" failures="0"> <testcase classname="send delete request" name="Then get status code 204" time="0" /> </testsuite> </testsuites>

This is a rounding issue. All test cases appear to be < 1s

0.003
0.003
0.001
0.001

so when rounding to 2 decimal points, it results to 0. I've increased the precision a bit and published new version 1.1.1 with this fix. Thank you for catching that