2

I have an interesting problem. I am using Ant which executes JUnit tests (test suite composed with 50 tests) via build.xml element. The problem is that I receive OutOfMemoryError.

I have enlarged heap space using ANT_OPTS arguments but it did not help. When I execute the same test suite in Eclipse - everything is fine - memory is released thanks to GC.

I think that this problem is related to Ant and its JUnit task.

Maybe logging of the tests are the reason(but on the other hand I have printsummary="false", [maybe outputtoformatters should be set to false as well???]).

My second guess is that TEST***.xml file (generated at the end of the test) is held in memory and flushed at the end of the test. Is there any way to reduce logs which are in that file?

Guys, please give me some clues.

Lucas Smith
  • 231
  • 3
  • 9

3 Answers3

1

You need to set the maxmemory attribute in the junit task. See the Ant documentation.

gareth_bowles
  • 20,760
  • 5
  • 52
  • 82
1

to sum up I want to say that the root of the problems was logging. Logs were sent to the stream and not flushed. After switching the logs off - everything was fine.

Lucas Smith
  • 231
  • 3
  • 9
0

By default the fork mode is off. Please try with fork mode on and forkmode set to pertest.

Jayan
  • 18,003
  • 15
  • 89
  • 143
  • I think that it will not help. I have @Suite runner with 50 tests. Such a bunch is treated as a single test - one TEST-xxx.xml report file. I think that report generation will be performed within that forked JVM so it will give no effect. Any more ideas? – Lucas Smith Aug 11 '12 at 07:22
  • @ Lucas Smith : please post the final ant file content and exception stack trace. – Jayan Aug 11 '12 at 14:12