Re: [Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-26 Thread Timo Rantalaiho
On Mon, 25 Jun 2007, Jean-Baptiste Quenot wrote:
 It's a pity  that you didn't mention the JIRA  issue in this email
 thread, as it would have helped to address the problem in a timely
 manner, I was not sure what bug you were exactly talking about and
 didn't ask.  Anyway now it's fixed, I discovered it is WICKET-254.

Yep I noticed, thankyou very much!

In fact we just discovered a workaround to a DropDownChoice
ajax issue with WicketTester in our app yesterday; I was
going to file an issue or talk about it here, but didn't
have time yet. It was something similar to the one just
discussed here, so I'll try later today whether your fix
also fixes that and report.

 If you  are aware  of other  bugs in  WicketTester, please  let us
 know, there  is no reason  why we  would want to  let WicketTester
 unmaintained, I'm sorry if you feel so.  This is a great tool that

No I don't, my workmate Kare seems more worried ;), and also
I think that the GUIs we're doing are relatively complex
with everything ajaxified and lots of dependencies between
screen components. That combined with serious TDD makes the
limitations of Wicket, WicketTester and our skills to
surface easily.

I for one will put more effort into bug reporting and making the
issues reproduceable after this encouraging experience of
having WICKET-254 fixed :) We have a couple of other test
methods disabled because we at least think that it was due
to WicketTester shortcomings, so let's see if something new
comes up.

 Be sure  that your bug reports  are very valuable, it's  true that

Good to hear. And to make it clear I also want to say that
Wicket and its community are excellent, and so is even
WicketTester with its possiblle shortcomings, as it allows
us to do 80-90 % of UI coding with relatively sane TDD.
That's much for any kind of UI framework.

Merci beaucoup,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-26 Thread Timo Rantalaiho
On Tue, 26 Jun 2007, Timo Rantalaiho wrote:
 In fact we just discovered a workaround to a DropDownChoice
 ajax issue with WicketTester in our app yesterday; I was
 going to file an issue or talk about it here, but didn't
 have time yet. It was something similar to the one just
 discussed here, so I'll try later today whether your fix
 also fixes that and report.

Yes, it's also fixed now!

Before we had to do

  wicket.setParameterForNextRequest(dropDownChoice.getPageRelativePath(), new 
Integer(index));

to get wicket.executeAjaxEvent(dropDownChoice, onchange);
to use the model value of choice index within the choices.  

Now we can do the more normal (albeit in this case more
verbose)

  
wicket.newFormTester(getForm().getPageRelativePath()).select(dropDownChoice, 
index);

Before, wicket.executeAjaxEvent() and FormTester seemed to
use separate requests (and thus the values set by FormTester
never ended up in the ajax request), but it seems that your
fix makes FormTester to work better with ajax. 

Rock!
- Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-26 Thread glr

I tried with formTester.submit() and the test went OK with that.

Anyway, thanks for informing about the fix (WICKET-254), I will take it into
use.

Regards,
Richard.


Jean-Baptiste Quenot-3 wrote:
 
 * Jean-Baptiste Quenot:
 * glr:
 
  FormTester formTester =
 this.tester.newFormTester(articleEditorForm, false);
  formTester.select(rscTypesList, 0);
  this.tester.executeAjaxEvent(articleEditorForm:rscTypesList,
 onchange);
 
 Can you please try with:
 
 formTester.submit();
 
 instead of:
 
 this.tester.executeAjaxEvent(articleEditorForm:rscTypesList,
 onchange);
 
 To see if it's not the ajax behavior that causes problems?
 
 Indeed  WicketTester was  overwriting field  values in  two places
 when submitting via  Ajax.  I just fixed this, you  can safely use
 executeAjaxEvent() now.
 
 The related JIRA issue is:
 
 Allow to set field values before submitting a form with Ajax in
 WicketTester
 https://issues.apache.org/jira/browse/WICKET-254
 -- 
  Jean-Baptiste Quenot
 aka  John Banana   Qwerty
 http://caraldi.com/jbq/
 
 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
 
 

-- 
View this message in context: 
http://www.nabble.com/Unit-testing---updating-a-DropDownChoice-with-Ajax-tf3946499.html#a11305654
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-25 Thread Jean-Baptiste Quenot
* glr:

 FormTester formTester = 
 this.tester.newFormTester(articleEditorForm, false);
 formTester.select(rscTypesList, 0);
 this.tester.executeAjaxEvent(articleEditorForm:rscTypesList, 
 onchange);

Can you please try with:

formTester.submit();

instead of:

this.tester.executeAjaxEvent(articleEditorForm:rscTypesList, 
onchange);

To see if it's not the ajax behavior that causes problems?

You may want to have a look at an existing working unit test for
selecting a new value with the DropDownChoice:

http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/apps_3/FormTesterTest.java?revision=530304view=markup
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-25 Thread Jean-Baptiste Quenot
* Jean-Baptiste Quenot:
 * glr:
 
  FormTester formTester = 
  this.tester.newFormTester(articleEditorForm, false);
  formTester.select(rscTypesList, 0);
  this.tester.executeAjaxEvent(articleEditorForm:rscTypesList, 
  onchange);
 
 Can you please try with:
 
 formTester.submit();
 
 instead of:
 
 this.tester.executeAjaxEvent(articleEditorForm:rscTypesList, 
 onchange);
 
 To see if it's not the ajax behavior that causes problems?

Indeed  WicketTester was  overwriting field  values in  two places
when submitting via  Ajax.  I just fixed this, you  can safely use
executeAjaxEvent() now.

The related JIRA issue is:

Allow to set field values before submitting a form with Ajax in WicketTester
https://issues.apache.org/jira/browse/WICKET-254
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-25 Thread Jean-Baptiste Quenot
* Timo Rantalaiho:

 (It's a pity that WicketTester has so many bugs or shortcomings;
 if I  ever find the spare  moment I'll try to  understand how it
 works  to  be able  to  do  better bug  reports  on  it or  even
 patches. Any help for getting into it is welcome!)

Hi Timo,

It's a pity  that you didn't mention the JIRA  issue in this email
thread, as it would have helped to address the problem in a timely
manner, I was not sure what bug you were exactly talking about and
didn't ask.  Anyway now it's fixed, I discovered it is WICKET-254.

If you  are aware  of other  bugs in  WicketTester, please  let us
know, there  is no reason  why we  would want to  let WicketTester
unmaintained, I'm sorry if you feel so.  This is a great tool that
we  use  a  lot,  we  just  have  different  usecases  than  yours
obviously, or it also happens that when something doesn't work, we
don't always have the  time to fix it and work  around it like any
developer would do.

Be sure  that your bug reports  are very valuable, it's  true that
you opened the issue  a few months ago, but one  day or another we
always end up resolving it.  Don't hesitate to remind us from time
to time of  the little cracks that  went in, and keep  up the good
bug reports ;-)
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-23 Thread Jean-Baptiste Quenot
* glr:

 I tried using WicketTester with FormTester but I cannot have the
 model  of the  first  DropDownChoice updated  as  a response  to
 making a selection in it.  As a result, when the OnEvent handler
 of the  AjaxFormComponentUpdatingBehavior fires, it looks  as if
 there was no selection in the first DropDownChoice.

Can you please provide a sample  code for your test?  Did you make
use of FormTester.select(String, int)?
-- 
 Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-19 Thread glr

Hi

I have 2 DropDownChoice's on a form. When making a choice in the first, the
choices in the second are updated using AjaxFormComponentUpdatingBehavior.
(Just like in the Drop Down Choice Example of the live action Wicket
Examples
(http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.ChoicePage)).

Could anyone tell me what the recommended way is to unit-test the above
case? 

I tried using WicketTester with FormTester but I cannot have the model of
the first DropDownChoice updated as a response to making a selection in it.
As a result, when the OnEvent handler of the
AjaxFormComponentUpdatingBehavior fires, it looks as if there was no
selection in the first DropDownChoice.

Thanks for your answer in advance,
Richard.
-- 
View this message in context: 
http://www.nabble.com/Unit-testing---updating-a-DropDownChoice-with-Ajax-tf3946499.html#a11195046
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-19 Thread Timo Rantalaiho
On Tue, 19 Jun 2007, glr wrote:
 I have 2 DropDownChoice's on a form. When making a choice in the first, the
 choices in the second are updated using AjaxFormComponentUpdatingBehavior.
 (Just like in the Drop Down Choice Example of the live action Wicket
 Examples
 (http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:wicket.examples.ajax.builtin.ChoicePage)).
 
 Could anyone tell me what the recommended way is to unit-test the above
 case? 
 
 I tried using WicketTester with FormTester but I cannot have the model of
 the first DropDownChoice updated as a response to making a selection in it.
 As a result, when the OnEvent handler of the
 AjaxFormComponentUpdatingBehavior fires, it looks as if there was no
 selection in the first DropDownChoice.

These model updates and/or ajax functionality cause a lot of
problems for WicketTester in our experience. I think that 
you just need to make your tests more static, e.g. one test 
to see that the onEvent handler is called and then another 
one where you set the model of the first DropDownChoice 
beforehand. Often you have more success in the tests if you
can init the models in the state to test already before
firing up WicketTester.

With SeleniumTestCase of Wicket Bench you can test
individual components with Selenium on Firefox to complement
WicketTester, which is an approach we used with success on
our previous project that was on Java 5 (required by Wicket
Bench). There's practically nothing that you couldn't test 
in Wicket like that, our ui code line coverage was well over
90 % in that project.

(It's a pity that WicketTester has so many bugs or
shortcomings; if I ever find the spare moment I'll try to 
understand how it works to be able to do better bug reports
on it or even patches. Any help for getting into it is
welcome!)

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unit testing - updating a DropDownChoice with Ajax

2007-06-19 Thread Eelco Hillenius
 (It's a pity that WicketTester has so many bugs or
 shortcomings; if I ever find the spare moment I'll try to
 understand how it works to be able to do better bug reports
 on it or even patches. Any help for getting into it is
 welcome!)

If you can, do it before the book comes out please :) We still have to
write about unit testing.

Eelco

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user