Testing bad file uploads
Martin Olsson <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I posted about this a while back but I havn't gotten it to work yet so
I'm gonna ask again and try to clarify my question. Any help is really
appreciated.
---
On my webpage I have a form where users can register new accounts.
This form has username, password and a file upload widget so that users
can provide images of themselves.
When a user submits this form with an empty username textbox the
webpages responds "username is a mandatory field".
Similar, when the form is submitted without an image the webpage says
"image is mandatory".
...and so on...
Now typically when I test my webpage manually I just surf around and use
the page as it supposed to be used. Submitting each possible form error
is very much work so I have written a httpunit module that crawls
through all my forms and makes sure that proper error messages are shown
when the forms are used in some bad way..
Everything works fine for textboxes, combo boxes, textarea controls but
for file upload controls (such as the image above) I have not managed to
get stuff working with httpunit. Basically, the problem is that when I
do this:
createUserForm.setParameter("form_user_image", "invalid_filename.txt");
I get the following thrown at me:
com.meterware.httpunit.FormParameter$UnusedParameterValueException:
Attempted to assign to parameter 'form_user_image' the extraneous value
'invalid_filename.txt'.
---
I suspect that somebody else have gone through these types of problems?
How can I use httpunit to submit a form with a filename that does not
exist because in mozilla/msie users can type in some obscure invalid
filenames and my webpage has error handling for this and I want to make
sure that this error handling is working as intended.
If what I want to achieve here is hard to do, can anyone recommend a
workaround that allows me to test the form with a bad/invalid filename?
sincerely,
martin
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642