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 Oy <URL: 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