It's almost certainly related to something occuring in your JSP.
buttons will be null if the buttons can not be found in the resulting HTML. Exactly why that is the case is what you need to determine. Note that you _do_ know that you're getting some HTML back from the server - otherwise you would get the NPE when assigning buttons in the first place (as you wouldn't have found the form)
Explicitly check the number of buttons in the test; if it's not right, dump the HTML for analysis.
Use a conditional break point in your debugger; the condition, of course, is for a null value for buttons.
Software is too expensive to build cheaply...
Joined: Sep 19, 2005
Well, I think the problem is that httpunit is not downloading the page completely, so I get some of html, but do not get the buttons/links.
I do get them when I set breakpoint and examine html, I suppose this gives httpunit some time to get full page.
My question is how do I get httpunit wait for whole page to load?
Joined: Sep 20, 2005
Read the source, Luke... HttpUnit already does wait for the page to load.
Check out the WebResponse class... getForms() calls getReceivedPage() which calls getText(), which calls loadResponseText(), which blocks and gets all the data as long as there is data to read.
I seriously recommend you assert the number of buttons, and dump the respone text if the length is wrong - this will let you examine the situation in the wild _after_ the problem is detected (which avoids any timing problems).
FWIW: The only time I ever saw a similar problem, it was a badly configured proxy server in the middle - it would occasionally truncate responses, usually on a 4K boundary.