You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Grotzke <ma...@javakaffee.de> on 2009/12/01 01:21:29 UTC

test for dropdownchoice with ajax - response is homepage always

Hi,

When I test a page like this
http://www.wicket-library.com/wicket-examples/ajax/choice
with wicket tester and submit the form, the response page is the
HomePage instead of the expected page (ChoicePage).

This issue was already reported some time ago without a final result:
http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html


I created an example project that shows this issue:
http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/

This is the short link to the failing test case (on github): http://is.gd/58mq3
This is the tested page class: http://is.gd/58mDm

I'm using wicket 1.4.3.

Is there any error in the test? Can I do anything to work around this,
or is it a bug?

Thanx && cheers,
Martin

-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Re: test for dropdownchoice with ajax - response is homepage always

Posted by Martin Grotzke <ma...@javakaffee.de>.
Great, it's working now. I didn't use exactly the same formTester which
was used for selecting the second dropdown before, that was the reason
why it didn't work.

Thanx for your help,
cheers,
Martin


On Tue, 2009-12-01 at 16:03 +0200, Martin Makundi wrote:
> > However, I already had tested this and it doesn't make any difference -
> > the test still fails with the same error.
> 
> I am not sure what you are doing. Do like this
> 
> {
>   // Operation 1
>   FormTester f1 = tester.newFormTester (...);
>   f1.setValue....
>   tester.execute ...
> }
> 
> {
>   // Operation 2
>   FormTester f1 = tester.newFormTester (...);
>   f1.setValue....
>   f1.submit
> }
> 
> 
> **
> Martin
> 
> >
> > Thanx && cheers,
> > Martin
> >
> >
> >>
> >> **
> >> Martin
> >>
> >> 2009/12/1 Martin Grotzke <ma...@javakaffee.de>:
> >> > On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
> >> >> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
> >> >> > shows the test?
> >> >>
> >> >> Ofcourse I didn't look ;)
> >> >>
> >> >> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY ONCE!
> >> >>
> >> >> If you want to use it another time, you need to call newFormTester again.
> >> > Thanx, this fixed the issue!
> >> >
> >> > Now I extended the test to make sure that the previously selected make
> >> > and model are still selected after the final submit - and this fails
> >> > with the second drop down (the model): this returns null from
> >> > dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
> >> > shows these changes.
> >> >
> >> > Is there another thing that needs to be changed in the test?
> >> >
> >> > Cheers,
> >> > Martin
> >> >
> >> >
> >> >>
> >> >> **
> >> >> Martin
> >> >> >
> >> >> >
> >> >> >>
> >> >> >> **
> >> >> >> Martin
> >> >> >>
> >> >> >> >
> >> >> >> > This issue was already reported some time ago without a final result:
> >> >> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
> >> >> >> >
> >> >> >> >
> >> >> >> > I created an example project that shows this issue:
> >> >> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
> >> >> >> >
> >> >> >> > This is the short link to the failing test case (on github): http://is.gd/58mq3
> >> >> >> > This is the tested page class: http://is.gd/58mDm
> >> >> >> >
> >> >> >> > I'm using wicket 1.4.3.
> >> >> >> >
> >> >> >> > Is there any error in the test? Can I do anything to work around this,
> >> >> >> > or is it a bug?
> >> >> >> >
> >> >> >> > Thanx && cheers,
> >> >> >> > Martin
> >> >> >> >
> >> >> >> > --
> >> >> >> > Martin Grotzke
> >> >> >> > http://www.javakaffee.de/blog/
> >> >> >> >
> >> >> >>
> >> >> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >>
> >> >> > --
> >> >> > Martin Grotzke
> >> >> > http://www.javakaffee.de/blog/
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> 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
> >>
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

Re: test for dropdownchoice with ajax - response is homepage always

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> However, I already had tested this and it doesn't make any difference -
> the test still fails with the same error.

I am not sure what you are doing. Do like this

{
  // Operation 1
  FormTester f1 = tester.newFormTester (...);
  f1.setValue....
  tester.execute ...
}

{
  // Operation 2
  FormTester f1 = tester.newFormTester (...);
  f1.setValue....
  f1.submit
}


**
Martin

>
> Thanx && cheers,
> Martin
>
>
>>
>> **
>> Martin
>>
>> 2009/12/1 Martin Grotzke <ma...@javakaffee.de>:
>> > On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
>> >> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
>> >> > shows the test?
>> >>
>> >> Ofcourse I didn't look ;)
>> >>
>> >> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY ONCE!
>> >>
>> >> If you want to use it another time, you need to call newFormTester again.
>> > Thanx, this fixed the issue!
>> >
>> > Now I extended the test to make sure that the previously selected make
>> > and model are still selected after the final submit - and this fails
>> > with the second drop down (the model): this returns null from
>> > dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
>> > shows these changes.
>> >
>> > Is there another thing that needs to be changed in the test?
>> >
>> > Cheers,
>> > Martin
>> >
>> >
>> >>
>> >> **
>> >> Martin
>> >> >
>> >> >
>> >> >>
>> >> >> **
>> >> >> Martin
>> >> >>
>> >> >> >
>> >> >> > This issue was already reported some time ago without a final result:
>> >> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
>> >> >> >
>> >> >> >
>> >> >> > I created an example project that shows this issue:
>> >> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
>> >> >> >
>> >> >> > This is the short link to the failing test case (on github): http://is.gd/58mq3
>> >> >> > This is the tested page class: http://is.gd/58mDm
>> >> >> >
>> >> >> > I'm using wicket 1.4.3.
>> >> >> >
>> >> >> > Is there any error in the test? Can I do anything to work around this,
>> >> >> > or is it a bug?
>> >> >> >
>> >> >> > Thanx && cheers,
>> >> >> > Martin
>> >> >> >
>> >> >> > --
>> >> >> > Martin Grotzke
>> >> >> > http://www.javakaffee.de/blog/
>> >> >> >
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >>
>> >> > --
>> >> > Martin Grotzke
>> >> > http://www.javakaffee.de/blog/
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>>
>

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


Re: test for dropdownchoice with ajax - response is homepage always

Posted by Martin Grotzke <ma...@javakaffee.de>.
On Tue, 2009-12-01 at 15:46 +0200, Martin Makundi wrote:
> Line 63 you are re-using the same formTester. Cannot work.
Wow, really fast! :)

However, I already had tested this and it doesn't make any difference -
the test still fails with the same error.

FWIW, I updated and pushed the test so that you can see what I actually
changed.

Thanx && cheers,
Martin


> 
> **
> Martin
> 
> 2009/12/1 Martin Grotzke <ma...@javakaffee.de>:
> > On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
> >> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
> >> > shows the test?
> >>
> >> Ofcourse I didn't look ;)
> >>
> >> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY ONCE!
> >>
> >> If you want to use it another time, you need to call newFormTester again.
> > Thanx, this fixed the issue!
> >
> > Now I extended the test to make sure that the previously selected make
> > and model are still selected after the final submit - and this fails
> > with the second drop down (the model): this returns null from
> > dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
> > shows these changes.
> >
> > Is there another thing that needs to be changed in the test?
> >
> > Cheers,
> > Martin
> >
> >
> >>
> >> **
> >> Martin
> >> >
> >> >
> >> >>
> >> >> **
> >> >> Martin
> >> >>
> >> >> >
> >> >> > This issue was already reported some time ago without a final result:
> >> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
> >> >> >
> >> >> >
> >> >> > I created an example project that shows this issue:
> >> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
> >> >> >
> >> >> > This is the short link to the failing test case (on github): http://is.gd/58mq3
> >> >> > This is the tested page class: http://is.gd/58mDm
> >> >> >
> >> >> > I'm using wicket 1.4.3.
> >> >> >
> >> >> > Is there any error in the test? Can I do anything to work around this,
> >> >> > or is it a bug?
> >> >> >
> >> >> > Thanx && cheers,
> >> >> > Martin
> >> >> >
> >> >> > --
> >> >> > Martin Grotzke
> >> >> > http://www.javakaffee.de/blog/
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> > --
> >> > Martin Grotzke
> >> > http://www.javakaffee.de/blog/
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> 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: test for dropdownchoice with ajax - response is homepage always

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Line 63 you are re-using the same formTester. Cannot work.

**
Martin

2009/12/1 Martin Grotzke <ma...@javakaffee.de>:
> On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
>> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
>> > shows the test?
>>
>> Ofcourse I didn't look ;)
>>
>> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY ONCE!
>>
>> If you want to use it another time, you need to call newFormTester again.
> Thanx, this fixed the issue!
>
> Now I extended the test to make sure that the previously selected make
> and model are still selected after the final submit - and this fails
> with the second drop down (the model): this returns null from
> dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
> shows these changes.
>
> Is there another thing that needs to be changed in the test?
>
> Cheers,
> Martin
>
>
>>
>> **
>> Martin
>> >
>> >
>> >>
>> >> **
>> >> Martin
>> >>
>> >> >
>> >> > This issue was already reported some time ago without a final result:
>> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
>> >> >
>> >> >
>> >> > I created an example project that shows this issue:
>> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
>> >> >
>> >> > This is the short link to the failing test case (on github): http://is.gd/58mq3
>> >> > This is the tested page class: http://is.gd/58mDm
>> >> >
>> >> > I'm using wicket 1.4.3.
>> >> >
>> >> > Is there any error in the test? Can I do anything to work around this,
>> >> > or is it a bug?
>> >> >
>> >> > Thanx && cheers,
>> >> > Martin
>> >> >
>> >> > --
>> >> > Martin Grotzke
>> >> > http://www.javakaffee.de/blog/
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> > --
>> > Martin Grotzke
>> > http://www.javakaffee.de/blog/
>> >
>>
>> ---------------------------------------------------------------------
>> 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: test for dropdownchoice with ajax - response is homepage always

Posted by Martin Grotzke <ma...@javakaffee.de>.
On Tue, 2009-12-01 at 11:44 +0200, Martin Makundi wrote:
> > Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
> > shows the test?
> 
> Ofcourse I didn't look ;)
> 
> Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY ONCE!
> 
> If you want to use it another time, you need to call newFormTester again.
Thanx, this fixed the issue!

Now I extended the test to make sure that the previously selected make
and model are still selected after the final submit - and this fails
with the second drop down (the model): this returns null from
dropDown.getDefaultModelObject. I pushed this, so http://is.gd/58mq3
shows these changes.

Is there another thing that needs to be changed in the test?

Cheers,
Martin


> 
> **
> Martin
> >
> >
> >>
> >> **
> >> Martin
> >>
> >> >
> >> > This issue was already reported some time ago without a final result:
> >> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
> >> >
> >> >
> >> > I created an example project that shows this issue:
> >> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
> >> >
> >> > This is the short link to the failing test case (on github): http://is.gd/58mq3
> >> > This is the tested page class: http://is.gd/58mDm
> >> >
> >> > I'm using wicket 1.4.3.
> >> >
> >> > Is there any error in the test? Can I do anything to work around this,
> >> > or is it a bug?
> >> >
> >> > Thanx && cheers,
> >> > Martin
> >> >
> >> > --
> >> > Martin Grotzke
> >> > http://www.javakaffee.de/blog/
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> > --
> > Martin Grotzke
> > http://www.javakaffee.de/blog/
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

Re: test for dropdownchoice with ajax - response is homepage always

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
> shows the test?

Ofcourse I didn't look ;)

Now, having looked at it your bug is that FORMTESTER CAN BE SUBMITTED ONLY ONCE!

If you want to use it another time, you need to call newFormTester again.

**
Martin
>
>
>>
>> **
>> Martin
>>
>> >
>> > This issue was already reported some time ago without a final result:
>> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
>> >
>> >
>> > I created an example project that shows this issue:
>> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
>> >
>> > This is the short link to the failing test case (on github): http://is.gd/58mq3
>> > This is the tested page class: http://is.gd/58mDm
>> >
>> > I'm using wicket 1.4.3.
>> >
>> > Is there any error in the test? Can I do anything to work around this,
>> > or is it a bug?
>> >
>> > Thanx && cheers,
>> > Martin
>> >
>> > --
>> > Martin Grotzke
>> > http://www.javakaffee.de/blog/
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
> --
> Martin Grotzke
> http://www.javakaffee.de/blog/
>

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


Re: test for dropdownchoice with ajax - response is homepage always

Posted by Martin Grotzke <ma...@javakaffee.de>.
On Tue, 2009-12-01 at 08:32 +0200, Martin Makundi wrote:
> Hi!
> 
> > When I test a page like this
> > http://www.wicket-library.com/wicket-examples/ajax/choice
> > with wicket tester and submit the form, the response page is the
> > HomePage instead of the expected page (ChoicePage).
> 
> Do you use a formtester? The wicket tester executeajax does not
> properly submit the form values so what we do is we create a dummy
> formtester before calling executeajaxevent. That might help.
Thanx for your feedback! Did you have a look at http://is.gd/58mq3 which
shows the test?

Yes, I'm using a formTester. What is your actual advice how to work
around? I didn't get this :)

Cheers,
Martin


> 
> **
> Martin
> 
> >
> > This issue was already reported some time ago without a final result:
> > http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
> >
> >
> > I created an example project that shows this issue:
> > http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
> >
> > This is the short link to the failing test case (on github): http://is.gd/58mq3
> > This is the tested page class: http://is.gd/58mDm
> >
> > I'm using wicket 1.4.3.
> >
> > Is there any error in the test? Can I do anything to work around this,
> > or is it a bug?
> >
> > Thanx && cheers,
> > Martin
> >
> > --
> > Martin Grotzke
> > http://www.javakaffee.de/blog/
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/

Re: test for dropdownchoice with ajax - response is homepage always

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!

> When I test a page like this
> http://www.wicket-library.com/wicket-examples/ajax/choice
> with wicket tester and submit the form, the response page is the
> HomePage instead of the expected page (ChoicePage).

Do you use a formtester? The wicket tester executeajax does not
properly submit the form values so what we do is we create a dummy
formtester before calling executeajaxevent. That might help.

**
Martin

>
> This issue was already reported some time ago without a final result:
> http://old.nabble.com/unit-test-for-dropdownchoice-with-ajax-td21141772.html
>
>
> I created an example project that shows this issue:
> http://github.com/magro/misc/tree/master/wicket-tester-drop-downs/
>
> This is the short link to the failing test case (on github): http://is.gd/58mq3
> This is the tested page class: http://is.gd/58mDm
>
> I'm using wicket 1.4.3.
>
> Is there any error in the test? Can I do anything to work around this,
> or is it a bug?
>
> Thanx && cheers,
> Martin
>
> --
> Martin Grotzke
> http://www.javakaffee.de/blog/
>

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