Hi,
As we are progressively building a number of authenticated
webapps, there is a recurrent problem when it comes to testing.
Namely, WicketTester does not use our custom WebApplication, just
because WicketTester already extends MockWebApplication. However,
in order to have a consistent behaviour between live webapp and
tests, we need to override the following methods:
* init() to define security settings
* getSessionFactory() to define a custom Session
* onUnauthorizedInstantiation() to redirect to the login page
And in fact we end up duplicating AuthenticatedWebApplication into
something called AuthenticatedWicketTester:
AuthenticatedWicketTester extends WicketTester implements
IRoleCheckingStrategy, IUnauthorizedComponentInstantiationListener
Of course duplicating the contents of a class is not something
that I'm satisfied with. So basically I think WicketTester should
be rewritten so that it takes our custom WebApplication into
account (eg in the constructor), then WicketTester is not a
WebApplication anymore but just a helper class, or an extension of
JUnit's TestCase.
What I would like to do:
WicketTester tester = new WicketTester(new CustomWebApplication());
tester.startPage(Page.class);
In other words, is there a need for WicketTester to be a
WebApplication?
There is also another problem with WicketTester: we cannot cast
(CustomWebApplication)getApplication() in a Page because that
won't work when doing the tests with WicketTester.
WDYT?
--
Jean-Baptiste Quenot
aka John Banana Qwerty
http://caraldi.com/jbq/
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop