For the following html page and HttpUnit test,
HttpUnit does not replace the URL arguments
(arg=replaced) that are in the form action with the
arguments generated by the form inputs. It leaves
them in the request, so that when the request is
submitted, the request url is http://toad/cgi-bin/bar?
arg=replaced&foo=a. Both IE and Firefox submit the
URL as http://toad/cgi-bin/bar?foo=a.
HTML page:
<FORM NAME=Bethsheba METHOD=GET ACTION=/cgi-bin/bar?
arg=replaced>
<INPUT TYPE=TEXT NAME=foo>
<INPUT TYPE=SUBMIT>
</FORM>
<br>
<!--JavaScript submit: <a
href="javascript:document.Bethsheba.submit()">go</a>--
>
HttpUnit Test:
import com.meterware.httpunit.*;
import junit.framework.*;
public class HttpUnitTest6 extends TestCase {
public HttpUnitTest6() {
super(null);
}
protected void setUp() throws Exception {
super.setUp();
ClientProperties.getDefaultProperties
().setAutoRefresh(true);
ClientProperties.getDefaultProperties
().setAutoRedirect(true);
}
protected void tearDown() throws Exception {
super.tearDown();
}
public void testHttpUnit() throws Exception {
WebConversation wc = new WebConversation();
WebRequest req = new GetMethodWebRequest
("http://www.myserver.com/test.html");
WebResponse resp = wc.getResponse(req);
WebForm form = resp.getFormWithName
("Bethsheba");
form.getScriptableObject().set("foo", "a");
resp = form.submit();
System.out.println("url: " + resp.getURL());
}
public static junit.framework.Test suite() {
return new junit.framework.TestSuite
(HttpUnitTest6.class);
}
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
}
Logged In: YES
user_id=1220573
Originator: NO
Dear Nathan,
thank you for the bug report and the excellent JUnit test describing it.
I've added you contribution to the subversion repository and have set the test and this bug to pending while we are
waiting for a patch.
It would be great if you'd contribute a patch for this.
I'm looking forward to your participation.
Yours
Wolfgang
Logged In: YES
user_id=1220573
Originator: NO
If you have a fix for this, I would be very happy to incorporate
it. Please include a test case or instructions for duplicating
the problem.
Logged In: YES
user_id=1400709
Originator: YES
As far as I know I never fixed this on my side and I don't have time to provide a fix. Sorry!
Logged In: YES
user_id=37920
Originator: NO
A test case would be good enough. We can fix it if we have that.
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Logged In: YES
user_id=1400709
Originator: YES
I already attached the test case. Simply put the HTML code in my original comments on a web server, and access it using the JUnit test case I included in my original comments. Is there more information that you need for the test case?
Logged In: YES
user_id=1220573
Originator: NO
Dear Nathan,
the comment list on this Bug reports gets a bit confusing at this time.
I tried to communicat that the test case was successfully added to the subversion repository by me.
Both Russell and you are than asking to add the testcase which seems to a miss understanding. Again - the testcase is there
and it has been set to pending since it clearly shows that httpunit does not do what is expected as outlined in your bugreport.
The next step naturally is to solve the problem by changing the httpunit software. If you got a patch for this that would be just great.
Yours
Wolfgang
Logged In: YES
user_id=1220573
Originator: NO
If you have a fix for this, I would be very happy to incorporate
it. Please include a test case or instructions for duplicating
the problem.
Logged In: YES
user_id=1400709
Originator: YES
You're right, it did get a bit confusing. :) I don't have a fix for this, and am unable to provide one at this time. So I'll leave it to someone else to do. Sorry for the confusion!