FormTester and FileUploadField

View: New views
4 Messages — Rating Filter:   Alert me  

FormTester and FileUploadField

by marco m :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm trying to write a unit test using the FormTester.

My page uses a CompoundPropertyModel.

My form contains a FileUploadField.

In my test, I call setValue for various form fields.

When I submit my form using the tester, all of the properties of my model object are null.

If I remove the FileUploadField from my form, the properties are set as expected.

I'm using wicket 1.3.4.

Does anyone know what I need to do to be able to use the FormTester with a form containing a FileUploadField?

Thanks

Re: FormTester and FileUploadField

by Timo Rantalaiho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 21 Jul 2008, marco m wrote:
> When I submit my form using the tester, all of the properties of my model
> object are null.

Print out the feedback messages from the Session. It sounds
like your FileUploadField.causes a validation error.

Best wishes,
Timo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: FormTester and FileUploadField

by marco m :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Print out the feedback messages from the Session. It sounds
like your FileUploadField.causes a validation error.
There's no messages there. If I call setFile to set a file on the FileUploadComponent then everything works as expected.  If no file is set then all of the fields of my model that correspond to form fields are set to null.

This only seems to happen when using the formTester, not in an actual browser session.

Re: FormTester and FileUploadField

by Timo Rantalaiho :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 24 Jul 2008, marco m wrote:
> There's no messages there. If I call setFile to set a file on the
> FileUploadComponent then everything works as expected.  If no file is set
> then all of the fields of my model that correspond to form fields are set to
> null.
>
> This only seems to happen when using the formTester, not in an actual
> browser session.

OK... and the file upload field is not required, so the form
should be submitable without filling anything in it?

It sounds like a possible FormTester bug, could you please
file a Jira issue on it? All the better if you can attach a
quickstart reproducing the problem, or even a patch with a
unit test failing because of the issue.

Best wishes,
Timo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

LightInTheBox - Buy quality products at wholesale price