Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 83765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:49:31+00:00 2026-05-10T21:49:31+00:00

How can we find the junit tests in our suite that take the longest

  • 0

How can we find the junit tests in our suite that take the longest amount of time to run? The default output of the junitreport ant task is helpful, but our suite has thousands of tests organized into many smaller suites, so it gets tedious, and the worst offenders are always changing.

We use luntbuild but ideally it would be something we could just run from ant.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:49:31+00:00Added an answer on May 10, 2026 at 9:49 pm

    JUnitReport works on the xml files produced by the JUnit task. You could write a task that would read the test durations out of the same xml files (TEST-*.xml). But you can also take a shortcut and just read the summary file created by JUnitReport (TESTS-TestSuites.xml) which has all the information in the single file.

    A quick way to do this is to use a bit of xsl to just show the slowest tests:

    <?xml version='1.0'?> <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>   <xsl:output method='text'/>    <xsl:template match='/'>     <xsl:text>    </xsl:text>     <xsl:for-each select='testsuites/testsuite'>     <xsl:sort select='@time' data-type='number' order='descending' />       <xsl:value-of select='@name'/> : <xsl:value-of select='@time'/>       <xsl:text>   </xsl:text>     </xsl:for-each>   </xsl:template> </xsl:stylesheet> 

    To run from Ant you do this:

    <target name='show.slow.tests'>     <xslt in='target/tests-results/TESTS-TestSuites.xml' out='target/slow.txt' style='slow.xsl'/> </target> 

    Then you can just look at the first X lines to find the X slowest tests:

    jfredrick$ head target/slow.txt

      ForcingBuildShouldNotLockProjectInQueuedStateTest : 11.581
      CruiseControlControllerTest : 7.335
      AntBuilderTest : 6.512
      Maven2BuilderTest : 4.412
      CompositeBuilderTest : 2.222
      ModificationSetTest : 2.05
      NantBuilderTest : 2.04
      CruiseControlConfigTest : 1.747
      ProjectTest : 1.743
      BuildLoopMonitorTest : 0.913
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can find ample evidence that MongoDBs are always kept in the order given
I have an ant build file that contains JUnit test suite that I would
I find that when running multiple gmock tests using and in memory database I
I am trying to find an approach that will allow me to run a
I'm building a Java program that will automatically run a hundred or so tests.
I'm developing a C# application to run JUnit tests automatically. Since it's complicated to
I'm trying to run the sample tests that come with junit4.7 and having some
I'm trying to use Arquillian for some unit tests, however I can't find why
I'm begginer in Java. Can you help me to find error? I run this
I'm trying to write some Junit tests to test old classes in our app.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.