Speed up JUnit tests in Ant
reloading : a feature that passed me by
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.
Simon is a hands-on software architect and has a BSc (Hons) in Computer Science from the University of Reading. Over the past 12 years, he’s been involved in projects ranging from rich desktop clients and web applications through to highly scalable distributed systems and service-oriented architectures; predominantly within the finance industry. He's also undertaken consulting and training roles with a broader focus on people, process and technology.

