victorolinasc / junit-formatter

A JUnit XML report exporter for Elixir's ExUnit
https://hexdocs.pm/junit_formatter/
Apache License 2.0
111 stars 37 forks source link

with Jira, time is not reported correctly #10

Closed ibizaman closed 8 years ago

ibizaman commented 8 years ago

For example, running one of my tests, the CLI formatter reports

add duplicates (46.9ms)

and the produced xml has:

<testcase classname="Elixir.My.Test" name="test add duplicates" time="46983"/>

But JIRA interprets 46983 as seconds. It looks like the JUnit format expects time in seconds. See excerpt taken from the JUnit specification:

<xs:attribute name="time" type="xs:decimal" use="required">
    <xs:annotation>
        <xs:documentation xml:lang="en">Time taken (in seconds) to execute the test</xs:documentation>
    </xs:annotation>
</xs:attribute>

The fix should be using a decimal value representing the time in seconds the test took.

cs-victor-nascimento commented 8 years ago

Good catch! The default time unit is way too granular. I will take a look at it now.

victorolinasc commented 8 years ago

@ibizaman fixed this with 1.0.0. It was about time I released a 1.0.0 version.

Time is reported in seconds (rounded down). So if your tests run in less then a second, it will report 0. If there is any problems with this approach, please tell me.