My friend Chris and I both work for the same company. Our product has around 900 JUnit tests, and for some of them, the default heap size that Eclipse runs JUnit tests with has become too small. You can change the heap size on individual JUnit launchers, but if you have lots of tests, this gets tedious. It also means that you have to run a test, see if it runs out of heap, change the setting and then rerun the test. We both thought there had to be a better way.
We were wrong. There is apparently no way within Eclipse to set a default heap size for JUnit launchers, which means you have to set them individually. We don’t like that.
Thus, JUnitLaunchFixer was born. This is an Eclipse plugin that will set the max heap size on a JUnit launcher when it is created to a value you have previously specified in the plugin preferences. The default is 1G, but you can tailor it to whatever you want. The first time you start Eclipse after installing the plugin, you will be presented with a selectable list of launchers that you can update, and a chance to set the default heap size. You can select as many or as few as you want. This will only be run once, unless you ask for it to run again by setting a preference.
JUnitLaunchFixer is released under the Eclipse Public License. It’s an open source project, so if there’s something you’d like to see it do, or you want to help out, let us know.
As of this moment, it’s only been tested with Eclipse Ganymede (3.4) on Windows 7 and Snow Leopard. I will be testing with Europa and Galileo soon.
You can download the source and build it yourself, but we also have an Eclipse update site to easily install it from http://junitlaunchfixer.googlecode.com/svn/trunk/JUnitLaunchFixer-update-site/