This post originated from an RSS feed registered with Java Buzz
by Simon Brown.
Original Post: Speed up JUnit tests in Ant
Feed Title: Simon Brown's weblog
Feed URL: http://www.simongbrown.com/blog/feed.xml?flavor=rss20&category=java
Feed Description: My thoughts on Java, software development and technology.
I've been having a few problems with some JUnit tests recently. They would run fine through IDEA, but would cause the JVM to hang whenever they were executed through an Ant build script. As a workaround, I just used the fork property of the junit task so that the tests would run in a separate JVM. This did the trick but slowed test execution down substantially.
In trying to solve this, I bought up the current documentation for the junit task and saw that v1.6 introduced a new reloading property. By default, the junit task creates a new classloader for each test case and this new property allows you to configure this behaviour. Now my tests work again and they're much, much faster. A handy little feature that passed me by.