You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Minto van der Sluis <mi...@multimach.com> on 2008/10/22 11:20:33 UTC
how to unittest a checkbox
Hi folks,
Creating unittests for my pages I managed to read the value a checkbox of a
rendered page. I used:
tester.assertModelValue( "form:myCheckBox, true );
However I failed to change that value in my unittest prior to submitting the
form.
Can anyone point in the right direction?
Kind regards,
Minto van der Sluis
--
View this message in context: http://www.nabble.com/how-to-unittest-a-checkbox-tp20106917p20106917.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to unittest a checkbox
Posted by Minto van der Sluis <mi...@multimach.com>.
Added https://issues.apache.org/jira/browse/WICKET-1893 WICKET-1893
jwcarman wrote:
>
> Since this is not so obvious, we should probably file a request in
> JIRA to add a checkbox-specific method to FormTester. Care to take
> care of that, since you found the issue?
>
> On Thu, Oct 23, 2008 at 9:15 AM, Minto van der Sluis
> <mi...@multimach.com> wrote:
>>
>> Thx that did the trick :-)
>>
>> For those who that come after me
>>
>> formTester.setValue( getCheckboxPath(), "on" ); // check
>> formTester.setValue( getCheckboxPath(), "off" ); // uncheck
>>
>> regards,
>>
>> Minto
>>
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-unittest-a-checkbox-tp20106917p20130698.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/how-to-unittest-a-checkbox-tp20106917p20145430.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to unittest a checkbox
Posted by James Carman <ja...@carmanconsulting.com>.
Since this is not so obvious, we should probably file a request in
JIRA to add a checkbox-specific method to FormTester. Care to take
care of that, since you found the issue?
On Thu, Oct 23, 2008 at 9:15 AM, Minto van der Sluis
<mi...@multimach.com> wrote:
>
> Thx that did the trick :-)
>
> For those who that come after me
>
> formTester.setValue( getCheckboxPath(), "on" ); // check
> formTester.setValue( getCheckboxPath(), "off" ); // uncheck
>
> regards,
>
> Minto
>
> --
> View this message in context: http://www.nabble.com/how-to-unittest-a-checkbox-tp20106917p20130698.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to unittest a checkbox
Posted by Minto van der Sluis <mi...@multimach.com>.
Thx that did the trick :-)
For those who that come after me
formTester.setValue( getCheckboxPath(), "on" ); // check
formTester.setValue( getCheckboxPath(), "off" ); // uncheck
regards,
Minto
--
View this message in context: http://www.nabble.com/how-to-unittest-a-checkbox-tp20106917p20130698.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to unittest a checkbox
Posted by Krzysztof Jelski <kj...@gmail.com>.
Try:
formTester.setValue(getCheckboxPath(), "on");
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to unittest a checkbox
Posted by Minto van der Sluis <mi...@multimach.com>.
thx for your reply.
Yes I already tried used FormTester, but I can't find any method to change
the value of a CheckBox besides the "select" method. But my checkbox is a
stand-alone one and not part of a group. Using the select method did not
results in the outcome I was looking for. :-(
1) Should I use a checkgroup with just one checkbox ?
2) Have I overlooked some other way to change the value of a CheckBox from
inside a unittest?
In regard to option 1, it feels incorrect to change working code just to
facilitate unittesting? If that's what it takes I will change my code. It's
just that I wonder if I missed something.
regards,
Minto van der Sluis
jwcarman wrote:
>
> Have you tried using FormTester?
>
> On Wed, Oct 22, 2008 at 5:20 AM, Minto van der Sluis
> <mi...@multimach.com> wrote:
>>
>> Hi folks,
>>
>> Creating unittests for my pages I managed to read the value a checkbox of
>> a
>> rendered page. I used:
>>
>> tester.assertModelValue( "form:myCheckBox, true );
>>
>> However I failed to change that value in my unittest prior to submitting
>> the
>> form.
>>
>> Can anyone point in the right direction?
>>
>> Kind regards,
>>
>> Minto van der Sluis
>>
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-unittest-a-checkbox-tp20106917p20106917.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/how-to-unittest-a-checkbox-tp20106917p20125169.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: how to unittest a checkbox
Posted by James Carman <ja...@carmanconsulting.com>.
Have you tried using FormTester?
On Wed, Oct 22, 2008 at 5:20 AM, Minto van der Sluis
<mi...@multimach.com> wrote:
>
> Hi folks,
>
> Creating unittests for my pages I managed to read the value a checkbox of a
> rendered page. I used:
>
> tester.assertModelValue( "form:myCheckBox, true );
>
> However I failed to change that value in my unittest prior to submitting the
> form.
>
> Can anyone point in the right direction?
>
> Kind regards,
>
> Minto van der Sluis
>
> --
> View this message in context: http://www.nabble.com/how-to-unittest-a-checkbox-tp20106917p20106917.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org