Ok, Thanks. My mistake. In fact I was looking for something like the one you suggested, delegating the whole scenario to my application object. One more question, what's your strategy for unit testing ? From what I saw in SortableTableHeadersTest ,would it be:

1- Setup the application, page and stuff
2- Feed the needed data to the page (probably with injection)
3- Setup request and response, and process the request cycle
4- Validate the generated page against some previously generated page

The last step is quite easy in simple applications, but in bigger ones, where the page style, or various tag attributes change frequently i'm looking for a more abstract way of validating the markup than just a string equality check.

Regards,
Iman

On 10/30/05, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
On 10/30/05, Iman RahmatiZadeh <[EMAIL PROTECTED]> wrote:
> Argh ! Unit testing is way too hard in wicket. I'm using a custom
> implementation of WebSession in my application. The problem arises when I
> use the MockWebApplication class for testing, which creates and uses
> WebSession for tests and my page classes which depend on my implementation
> of WebSession cant work with it. I can't implement another
> MockWebApplication, because getSession() in WebApplication has package
> access, and it's critical for setting up the session. Has anybody solved
> such problems ? Does anybody know the preferred way of unit testing (not
> functional testing) the pages ?

Where does MockWebApplication create its own WebSession??? It uses
WebApplication.getSessionFactory().newSession() which is Wickets
standard means and works nicely in my unit tests.

WicketTester is derived from MockWebApplication and provides some
convience method. May be that is what your are looking for.

What IMO would be nice if MockWebApplication would delegate to my
application object instead of being derived from WebApplication.
Reason: Today I basically have to copy MyApplication to
MyMockApplication and changes the derived class to MockWebApplication.
If MockWebApplication would delegate to an application object, there
were no more need to do so.

Juergen


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to