jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Sonar
  • SONAR-602

Surefire time is calculated wrong.

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.8
  • Component/s: None
  • Labels:
    None

Description

Surefire xml time="0.341" results in 5'41" while surefire txt file states: Time elapsed: 0.341 sec.

And thus the overall code coverage time is way bigger than the total build time.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. HTML File
    JUnitTest.html
    30/Mar/09 11:00 AM
    17 kB
    Jene Jasper
  2. Java Source File
    JUnitTest.java
    30/Mar/09 11:00 AM
    2 kB
    Jene Jasper
  3. XML File
    TEST-nl.abz.report.sample.JUnitTest.xml
    30/Mar/09 11:00 AM
    6 kB
    Jene Jasper

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Olivier Gaudin added a comment - 25/Mar/09 8:42 AM

Jene, do you still have the issue ? Can you tell a bit more about it ? Are you talking about the time for the whole project or for a specific test ?

Thanks

Show
Olivier Gaudin added a comment - 25/Mar/09 8:42 AM Jene, do you still have the issue ? Can you tell a bit more about it ? Are you talking about the time for the whole project or for a specific test ? Thanks
Hide
Permalink
Jene Jasper added a comment - 30/Mar/09 11:00 AM

Sample JUnitTest class from out QA Sandbox (used to eliminate duplicate entries between FindBugs, PMD and Checkstyle).

The sure-fire output for this file (see: <testsuite failures="0" time="0.27")

Resulting Sonar report: (see
<td>
<a href="#" onclick="javascript:showResourceViewer('30', null);">JUnitTest</a>
</td>
<td class="right">27 sec</td>
)

Should be 0.27 sec.

Show
Jene Jasper added a comment - 30/Mar/09 11:00 AM Sample JUnitTest class from out QA Sandbox (used to eliminate duplicate entries between FindBugs, PMD and Checkstyle). The sure-fire output for this file (see: <testsuite failures="0" time="0.27") Resulting Sonar report: (see <td> <a href="#" onclick="javascript:showResourceViewer('30', null);">JUnitTest</a> </td> <td class="right">27 sec</td> ) Should be 0.27 sec.
Hide
Permalink
Freddy Mallet added a comment - 30/Mar/09 11:08 AM

Jene, looks like an issue on the Local used to parse "0.27".

Could you give the default Local on your computer, I guess with this default Local 0.27 = 27 or something like that ?

thanks for your help
Freddy

Show
Freddy Mallet added a comment - 30/Mar/09 11:08 AM Jene, looks like an issue on the Local used to parse "0.27". Could you give the default Local on your computer, I guess with this default Local 0.27 = 27 or something like that ? thanks for your help Freddy
Hide
Permalink
Jene Jasper added a comment - 31/Mar/09 7:41 AM

System.out.println(">>>:" + locale.toString()); is >>>:nl_NL

Show
Jene Jasper added a comment - 31/Mar/09 7:41 AM System.out.println(">>>:" + locale.toString()); is >>>:nl_NL
Hide
Permalink
Freddy Mallet added a comment - 01/Apr/09 8:50 AM - edited

Looks like the surfire report doesn't use the default Locale to generate the xml report. So we shouldn't use it to parse this report.

NumberFormat fr = NumberFormat.getInstance(new Locale("fr", "FR"));
NumberFormat us = NumberFormat.getInstance(new Locale("us", "US"));
NumberFormat nl = NumberFormat.getInstance(new Locale("nl", "NL"));
NumberFormat ch = NumberFormat.getInstance(new Locale("ch", "CH"));
		
assertEquals(0.345, us.parse("0.345").doubleValue(), 0.01);
assertEquals(0.345, ch.parse("0.345").doubleValue(), 0.01);
assertEquals(0, fr.parse("0.345").doubleValue(), 0.01);		
assertEquals(345, nl.parse("0.345").doubleValue(), 0.01);
Show
Freddy Mallet added a comment - 01/Apr/09 8:50 AM - edited Looks like the surfire report doesn't use the default Locale to generate the xml report. So we shouldn't use it to parse this report.
NumberFormat fr = NumberFormat.getInstance(new Locale("fr", "FR"));
NumberFormat us = NumberFormat.getInstance(new Locale("us", "US"));
NumberFormat nl = NumberFormat.getInstance(new Locale("nl", "NL"));
NumberFormat ch = NumberFormat.getInstance(new Locale("ch", "CH"));
		
assertEquals(0.345, us.parse("0.345").doubleValue(), 0.01);
assertEquals(0.345, ch.parse("0.345").doubleValue(), 0.01);
assertEquals(0, fr.parse("0.345").doubleValue(), 0.01);		
assertEquals(345, nl.parse("0.345").doubleValue(), 0.01);
Hide
Permalink
Cédric Munger added a comment - 01/Apr/09 9:57 AM

After some checks, the surefire xml report code is using the following locale to format the time values in the report file :

private NumberFormat numberFormat = NumberFormat.getInstance( Locale.ENGLISH );

see :

http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java?revision=601023&view=markup&pathrev=601023

We will also hardcode to Locale.ENGLISH the numberformat instance we use to parse this value and the issue will be fixed.

Show
Cédric Munger added a comment - 01/Apr/09 9:57 AM After some checks, the surefire xml report code is using the following locale to format the time values in the report file : private NumberFormat numberFormat = NumberFormat.getInstance( Locale.ENGLISH ); see : http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java?revision=601023&view=markup&pathrev=601023 We will also hardcode to Locale.ENGLISH the numberformat instance we use to parse this value and the issue will be fixed.

People

  • Assignee:
    Freddy Mallet
    Reporter:
    Jene Jasper
Vote (0)
Watch (0)

Dates

  • Created:
    28/Jan/09 3:41 AM
    Updated:
    15/Apr/09 6:43 AM
    Resolved:
    02/Apr/09 8:26 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.