Re: [Httpunit-develop] WebForm doesnt recognise the Select options populated
Brought to you by:
russgold
|
From: <leh...@bn...> - 2003-03-28 10:40:10
|
Hello
Thanks for the advice.
I tried to execute WebFormTest from the web site.
For this code:
public void testMultiSelect() throws Exception {
defineWebPage( "Default", "<form method=GET action = \"/ask\">" +
"<Select multiple size=4 name=colors>" +
"<Option>blue<Option selected>red \n" +
"<Option>green<Option value=\"pink\" selected>salmon</select>" +
"<Input type=submit></form>" );
WebResponse page = _wc.getResponse( getHostPath() + "/Default.html" );
WebForm form = page.getForms()[0];
String[] parameterNames = form.getParameterNames();
assertEquals( "num parameters", 1, parameterNames.length );
assertEquals( "parameter name", "colors", parameterNames[0] );
assertTrue( "Found extraneous values for unknown parameter 'magic'", form.getParameterValues( "magic" ).length == 0 );
assertMatchingSet( "Select defaults", new String[] { "red", "pink" }, form.getParameterValues( "colors" ) );
assertMatchingSet( "Select options", new String[] { "blue", "red", "green", "salmon" }, form.getOptions( "colors" ) );
assertEquals( "Select values", new String[] { "blue", "red", "green", "pink" }, form.getOptionValues( "colors" ) );
WebRequest request = form.getRequest();
assertMatchingSet( "Request defaults", new String[] { "red", "pink" }, request.getParameterValues( "colors" ) );
assertEquals( "URL", getHostPath() + "/ask?colors=red&colors=pink", request.getURL().toExternalForm() );
form.setParameter( "colors", "green" );
assertEquals( "New select value", new String[] { "green" }, form.getParameterValues( "colors" ) );
form.setParameter( "colors", new String[] { "blue", "pink" } );
assertEquals( "New select value", new String[] { "blue", "pink" }, form.getParameterValues( "colors" ) );
try {
form.setParameter( "colors", new String[] { "red", "colors" } );
fail( "Should have rejected set with bad values" );
} catch (IllegalRequestParameterException e) {
}
form.reset();
assertMatchingSet( "Reverted colors", new String[] { "red", "pink" }, form.getParameterValues( "colors" ) );
}
I got this exception:
3) testMultiSelect(com.bnpparibas.risk.ims.web.httpunit.user.WebFormTest)junit.framework.AssertionFailedError: Select defaults: expected
{"red","pink"} but found {}
at com.meterware.pseudoserver.HttpUserAgentTest.assertMatchingSet(HttpUserAgentTest.java:172)
at com.bnpparibas.risk.ims.web.httpunit.user.WebFormTest.testMultiSelect(WebFormTest.java:329)
at com.bnpparibas.risk.ims.web.httpunit.user.WebFormTest.main(WebFormTest.java:39)
I actually did change nekohtml to tidy.jar , and it didnt help for this example.
Any suggestions?
Thanks
Lehavit
Internet
kv...@ac...@lists.sourceforge.net - 25/03/2003 15:20
Please respond to htt...@li...
Sent by: htt...@li...
To: httpunit-develop
cc:
Subject: Re: [Httpunit-develop] WebForm doesnt recognise the Select
options populated
At 09:34 AM 3/24/2003 +0000, you wrote:
>Hi
>
>Yes, the attempted option is there, I just copied few options and not all
>for the example
>but it was there as well.
>It seem that httpUnit thinks that the option list is empty.
I had a problem like this and it went away when I changed jars from
nekohtml to tidy.jar (which means I need to send a test example to
them). There is a select test in the HttpUnit tests (WebFormTest); try it
in your environment to see if the problem is your environment.
-Kathy Van Stone
-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
_______________________________________________
Httpunit-develop mailing list
Htt...@li...
https://lists.sourceforge.net/lists/listinfo/httpunit-develop
This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.
---------------------------------------------
Ce message et toutes les pieces jointes (ci-apres le
"message") sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.
|