You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Benda <be...@bendis.cz> on 2006/11/30 08:43:29 UTC

WicketTester cannot test applications with custom WebRequestCycle

Hi,

I ran into problems when I tried to write some unit tests using WicketTester 
to test my application: The application creates its own RequestCycle which 
extends WebRequestCycle (by overriding 
WebApplication#getRequestCycleFactory). But when testing the application 
inside the WicketTester, RequestCycle is always WebRequestCycle, not the one 
created by the factory.

The problem is IMO in the MockWebApplication class - it creates request cycles 
by "new WebRequestCycle(...)" - shouldn't it use 
Session#getRequestCycleFactory#newRequestCycle(...) instead?

The attached patch solves this problem - at least for me :-)

P.S.: The patch was created for wicket-2.0 trunk.

Bendis

Re: WicketTester cannot test applications with custom WebRequestCycle

Posted by Juergen Donnerstag <ju...@gmail.com>.
I applied the patch yesterday but didn't want to commit it (yet) as in
2.0 still quite some junit tests are failing. They should be fixed
first to avoid side effects.

Juergen

On 11/30/06, Frank Bille <fr...@gmail.com> wrote:
> Thank you
>
> Frank
>
> On 11/30/06, Martin Benda <be...@bendis.cz> wrote:
> >
> > Ok, I've created a new issue and attached patches for 2.0 and 1.x - see
> > JIRA:
> > http://issues.apache.org/jira/browse/WICKET-129
> >
> > Bendis
> >
> > Dne čtvrtek 30 listopad 2006 14:27 Frank Bille napsal(a):
> > > That sounds fair enough. Can you please attach your patch to JIRA so we
> > > don't forget it?
> > >
> > > Frank
> > >
> > > On 11/30/06, Martin Benda <be...@bendis.cz> wrote:
> > > > Hi,
> > > >
> > > > I ran into problems when I tried to write some unit tests using
> > > > WicketTester
> > > > to test my application: The application creates its own RequestCycle
> > > > which extends WebRequestCycle (by overriding
> > > > WebApplication#getRequestCycleFactory). But when testing the
> > application
> > > > inside the WicketTester, RequestCycle is always WebRequestCycle, not
> > the
> > > > one
> > > > created by the factory.
> > > >
> > > > The problem is IMO in the MockWebApplication class - it creates
> > request
> > > > cycles
> > > > by "new WebRequestCycle(...)" - shouldn't it use
> > > > Session#getRequestCycleFactory#newRequestCycle(...) instead?
> > > >
> > > > The attached patch solves this problem - at least for me :-)
> > > >
> > > > P.S.: The patch was created for wicket-2.0 trunk.
> > > >
> > > > Bendis
> >
>

Re: WicketTester cannot test applications with custom WebRequestCycle

Posted by Frank Bille <fr...@gmail.com>.
Thank you

Frank

On 11/30/06, Martin Benda <be...@bendis.cz> wrote:
>
> Ok, I've created a new issue and attached patches for 2.0 and 1.x - see
> JIRA:
> http://issues.apache.org/jira/browse/WICKET-129
>
> Bendis
>
> Dne čtvrtek 30 listopad 2006 14:27 Frank Bille napsal(a):
> > That sounds fair enough. Can you please attach your patch to JIRA so we
> > don't forget it?
> >
> > Frank
> >
> > On 11/30/06, Martin Benda <be...@bendis.cz> wrote:
> > > Hi,
> > >
> > > I ran into problems when I tried to write some unit tests using
> > > WicketTester
> > > to test my application: The application creates its own RequestCycle
> > > which extends WebRequestCycle (by overriding
> > > WebApplication#getRequestCycleFactory). But when testing the
> application
> > > inside the WicketTester, RequestCycle is always WebRequestCycle, not
> the
> > > one
> > > created by the factory.
> > >
> > > The problem is IMO in the MockWebApplication class - it creates
> request
> > > cycles
> > > by "new WebRequestCycle(...)" - shouldn't it use
> > > Session#getRequestCycleFactory#newRequestCycle(...) instead?
> > >
> > > The attached patch solves this problem - at least for me :-)
> > >
> > > P.S.: The patch was created for wicket-2.0 trunk.
> > >
> > > Bendis
>

Re: WicketTester cannot test applications with custom WebRequestCycle

Posted by Martin Benda <be...@bendis.cz>.
Ok, I've created a new issue and attached patches for 2.0 and 1.x - see JIRA: 
http://issues.apache.org/jira/browse/WICKET-129

Bendis

Dne čtvrtek 30 listopad 2006 14:27 Frank Bille napsal(a):
> That sounds fair enough. Can you please attach your patch to JIRA so we
> don't forget it?
>
> Frank
>
> On 11/30/06, Martin Benda <be...@bendis.cz> wrote:
> > Hi,
> >
> > I ran into problems when I tried to write some unit tests using
> > WicketTester
> > to test my application: The application creates its own RequestCycle
> > which extends WebRequestCycle (by overriding
> > WebApplication#getRequestCycleFactory). But when testing the application
> > inside the WicketTester, RequestCycle is always WebRequestCycle, not the
> > one
> > created by the factory.
> >
> > The problem is IMO in the MockWebApplication class - it creates request
> > cycles
> > by "new WebRequestCycle(...)" - shouldn't it use
> > Session#getRequestCycleFactory#newRequestCycle(...) instead?
> >
> > The attached patch solves this problem - at least for me :-)
> >
> > P.S.: The patch was created for wicket-2.0 trunk.
> >
> > Bendis

Re: WicketTester cannot test applications with custom WebRequestCycle

Posted by Frank Bille <fr...@gmail.com>.
That sounds fair enough. Can you please attach your patch to JIRA so we
don't forget it?

Frank


On 11/30/06, Martin Benda <be...@bendis.cz> wrote:
>
> Hi,
>
> I ran into problems when I tried to write some unit tests using
> WicketTester
> to test my application: The application creates its own RequestCycle which
> extends WebRequestCycle (by overriding
> WebApplication#getRequestCycleFactory). But when testing the application
> inside the WicketTester, RequestCycle is always WebRequestCycle, not the
> one
> created by the factory.
>
> The problem is IMO in the MockWebApplication class - it creates request
> cycles
> by "new WebRequestCycle(...)" - shouldn't it use
> Session#getRequestCycleFactory#newRequestCycle(...) instead?
>
> The attached patch solves this problem - at least for me :-)
>
> P.S.: The patch was created for wicket-2.0 trunk.
>
> Bendis
>
>
>