I have been looking at the performance of our web integration tests lately. They are an order of magnitude slower than our EJB integration tests.
JavaScipt!
——-
It turns out 70% of the time taken by HttpUnit is setting up the JavaScript interpreter for each response. Some tests need this but not many. In your method where you create your default WebConversation just turn off the JavaScript as follows:
HttpUnitOptions.setScriptingEnabled(false);
WebConversation conversation = new WebConversation();
And then turn it on with HttpUnitOptions.setScriptingEnabled(true) for those WebConversations that need it.
On a test page on an AMD64 we went from 7 seconds to 1.5 for 200 test runs with this change only.
The next culprit: dom4J
——————-
We also create a DOM using dom4j in order to do XPath evaluation. This is also VERY expensive. Removing this gives about the same level of improvement. The new HttpUnit 1.6 makes resorting to XPath a little less necessary. We will gradually phase it out.