• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

OutOfMemoryError while executing JUnit Test cases with maven install

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am executing more than 1,000 Junit test cases using TestSuits together in one shot. In order to execute these test cases as Junit, it is working fine but when executing it as the maven install, it is throwing OutOfMemoryError at almost after the count of 150.

I tried to maximize jvm heap size but the problem persisted.

After I found another solution updating the configuration details in POM.xml as below:



After doing this I am able to execute all the JUnit test cases without having and OutOfMemoryError but performance got degraded. I want to know:

1) How can I improve the performance ?
1) Is changes mentioned above in POM.xml are OK ?
2) Can we mentioned the memory allocation in POM.xml like the way mentioned above ?

Best Regards,
Pratik
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see anything wrong with what you did (although I've always just specified the args on the command line). Still, if you're running out of memory after 150 tests, I'd make sure your tests are releasing whatever they're using, because that seems kind of extreme. As a counter-example, I have a project that has thousands of tests, and it makes it through the bulk of them before throwing an OOME.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

have you checked the Maven settings for the JVM itself ?

Kind regards
Karl Heinz Marbaise
 
Pratik Surti
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I have managed to change the settings for maven jvm heap size.

After doing the changes in POM.xml, OutOfMemoryError is resolved. Only issue with performance.

It takes 34 minutes to successfully execute 1,117 Junit test cases with Maven. Running it normally through Eclipse Junit, it takes around 15 minutes.

Is there any chance of having multiple object references not released after the execution ?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure you want to fork per test? (Which as far as I know is for backwards compatibility, as per the docs.) I'd try that to see what the difference is.
 
Pratik Surti
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if this is the case of backward compatibility then my junit test case do not have dependency on each other, as they are independent of execution.

Which approach shall I try instead of fork per test ?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
*Maven* backwards compatibility. I don't know, the default of "once"?
 
Pratik Surti
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me try with"once". I will update in some time.
 
Pratik Surti
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Good to see the performance improvement as below. It has now taken 10 minutes.

 
grapes are vegan food pellets. Eat this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic