I just started using HttpUnit today (it looks like it will be very helpful in testing our application suite), and I am attempting to simply load our application home page and list some information about it.
Here is a code snippet for what I am attempting to do:
WebConversation wc = new WebConversation() ;
response = wc.getResponse("http://localhost:8080/myApplication/") ; //ERROR
WebForm forms = response.getForms() ;
// Probably will output something simple about the forms
The call to "getResponse()" is failing with the following:
(the rest of the stack trace is omitted).
I could understand where this might be a problem, except for the fact that I find the Form in the page source:
<form name="searchForm" method="get" action="/myApplication/search.do
onsubmit="return submitSimpleSearch(this)" style="display: inline;">
<select name="searchType" onchange="adjustEmailDisplay(searchForm)">
<option value="keyword">Keyword</option> <option value="itemNumber">Item Number</option>
<option value="orderNumber">Order Number</option>
<input type="text" name="keyword" maxlength="50" size="18" value="">
<span id="emailspan" style="display: none; visibility: hidden;">
<input type="text" name="emailAddress" maxlength="80" size="18"
<input type="submit" value="Search">
<input type="hidden" name="numResults" value="">
The form itself is actually built via JSP (using standard custom tags):
<sslext:form method="get" action="/search.do" style="display: inline;"
(other stuff omitted)
which shouldn't make any difference (as far as I can tell anyway).
I would really like to see this work, but I don't see anything obviously wrong. Is there something wrong with the page that I am not seeing? Or is there something wrong with what I am trying to do?
A little additional info about the error: Further down the stack trace is the following line:
This might be helpful.