Runner for forked Junit tests [message #754592] |
Thu, 03 November 2011 08:57  |
Eclipse User |
|
|
|
Hi,
we're running into memory problems inside Eclipse when running our Junit test suite and it is because of the standard Junit runner keeping references from old tests (as documented in a number of places on the net). We don't want to spend time null:ing out all fields in our test cases, since the same thing works with an ant task with the "fork=yes" option. I can run the the ant task we have, but then I only get the output in the console and not the graphical output from the regular junit runner, so that isn't good enough for our users. Also, increasing the memory for the test configuration is just a temporary solution since in that case, it will just keep growing until it becomes too large next time.
So what I'd like is:
a) an option to the standard JUnit runner to make it fork the way that ant does junit, so we don't have to modify our test classes
b) get a better integration for running the ant task so that is uses the junit "GUI output" (and that it updates it during runtime, the pure import of the XML afterwards doesn't solve it for us).
Is there any existing solution for either of the above?
If not, how difficult would it be to modify the core JUnit runner to use ant or to fork? Or would it be as easy to write new plug-in from scratch?
Note: Using Junit4 and Eclipse 3.7.
BR,
Chris
|
|
|
|
Re: Runner for forked Junit tests [message #755323 is a reply to message #755145] |
Tue, 08 November 2011 02:18   |
Eclipse User |
|
|
|
Hi Markus,
thanks for the reply.
According to what I can see, the JUnit runner in Eclipse keeps references to the test classes that is has previously run and therefore leaves a lot of memory around that ant doesn't. Therefore, I don't get the "fork" behavior that I would like.
There seems to be others that have noticed this, see for example this (somewhat older) page: www.symphonious.net/2006/09/19/junit-memory-usage-in-eclipse/ (I have foudn the same "complaints" on other sites/forums as well). I've run our tests through a profiler and I see the same kind of problem. I don't want to require our developers having to null out all the fields to get the same kind of performance we get from ant. Please correct me if I have missed something obvious here
I think there are multiple advantages of having ant run the tests "integrated" into the eclipse runner. For example, in ant, it is relatively easy to set up a target for running the tests in multiple parallel threads to speed up the execution (yes, I know, our tests are far too slow to be proper unit tests....), which I haven't found a way to do from eclipse.
BR,
Chris
|
|
|
|
|
|
|
Re: Runner for forked Junit tests [message #757260 is a reply to message #756910] |
Thu, 17 November 2011 06:47  |
Eclipse User |
|
|
|
Hi again Markus,
I think we misunderstood each other a bit in the beginning, but now we're on the same page.
We've started to work on a modification of the runner that will allow JUnit in multiple JVMs from Eclipse and the initial prototyping seems promising. Our main issue with the current Eclipse runner is that we have large static objects that are kept around when using a single JVM. So if we can fix the runner, that is easier than having to make "SoftReference-caches" out of all static objects.
Thanks for the help.
/Chris
|
|
|
Powered by
FUDForum. Page generated in 0.04521 seconds