You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Otho <ta...@googlemail.com> on 2007/05/27 14:53:18 UTC

T5: Testing - PageTester reworked... How do I use mock services now?

Hi all!
I followed the TestNG example with service replacements on the Tapestry home
page only to find out that PageTester was reworked and now doesn't support a
map with replacements anymore. I was unable to find any documentation in the
changelogs or the mailinglist about why this was changed and how to use mock
services with a PageTester right now.

Start page depends on a spring service and this doesn't get injected
automatically. So if I want to test it I have to somehow inject a Mock in
there, or did I get something wrong?

Regards,
Otho

Re: T5: Testing - PageTester reworked... How do I use mock services now?

Posted by lasitha ranatunga <la...@gmail.com>.
A quick follow up to this thread from June:

Joel Wiegman <JoelWiegman <at> btservices.com> writes:
> 
> > "You can specify the additional module classes when creating the page
> > tester."
> 
> Howard, could you go into a little more detail here?  I didn't see a
> constructor arg or a method on PageTester for specifying additional
> modules.

Just noticed that - as of revision 584927 - the PageTester constructor 
now accepts optional module classes to load.  So mocking services will 
be easy in 5.0.6 (or the nightlies).  w00t!

Cheers, lasitha.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: T5: Testing - PageTester reworked... How do I use mock services now?

Posted by Joel Wiegman <Jo...@btservices.com>.
"You can specify the additional module classes when creating the page
tester."

Howard, could you go into a little more detail here?  I didn't see a
constructor arg or a method on PageTester for specifying additional
modules.

-----Original Message-----
From: Howard Lewis Ship [mailto:hlship@gmail.com] 
Sent: Sunday, May 27, 2007 7:28 PM
To: Tapestry users
Subject: Re: T5: Testing - PageTester reworked... How do I use mock
services now?

It's a good point. What you need to do is define a module that defines
your mock services, and contributes overrides into the Alias or
AliasOverride service configuration, such that your mock services are
used instead of the normal ones.  You can specify the additional module
classes when creating the page tester.

On 5/27/07, Otho <ta...@googlemail.com> wrote:
>
> Hi all!
> I followed the TestNG example with service replacements on the 
> Tapestry home page only to find out that PageTester was reworked and 
> now doesn't support a map with replacements anymore. I was unable to 
> find any documentation in the changelogs or the mailinglist about why 
> this was changed and how to use mock services with a PageTester right 
> now.
>
> Start page depends on a spring service and this doesn't get injected 
> automatically. So if I want to test it I have to somehow inject a Mock

> in there, or did I get something wrong?
>
> Regards,
> Otho
>



--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant Creator and PMC Chair,
Apache Tapestry Creator, Apache HiveMind

Professional Tapestry training, mentoring, support and project work.
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: T5: Testing - PageTester reworked... How do I use mock services now?

Posted by Joel Wiegman <Jo...@btservices.com>.
Otho,

Any chance you could share an example of this with the community?  I'm
having a hard time finding an example on the T5 website.

Thanks!

Joel 

-----Original Message-----
From: Otho [mailto:taar93@googlemail.com] 
Sent: Tuesday, May 29, 2007 4:36 AM
To: Tapestry users
Subject: Re: T5: Testing - PageTester reworked... How do I use mock
services now?

Thanks for the answer, works perfectly now.

2007/5/28, Howard Lewis Ship <hl...@gmail.com>:
>
> It's a good point. What you need to do is define a module that defines

> your mock services, and contributes overrides into the Alias or 
> AliasOverride service configuration, such that your mock services are 
> used instead of the normal ones.  You can specify the additional 
> module classes when creating the page tester.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: Testing - PageTester reworked... How do I use mock services now?

Posted by Otho <ta...@googlemail.com>.
Thanks for the answer, works perfectly now.

2007/5/28, Howard Lewis Ship <hl...@gmail.com>:
>
> It's a good point. What you need to do is define a module that defines
> your
> mock services, and contributes overrides into the Alias or AliasOverride
> service configuration, such that your
> mock services are used instead of the normal ones.  You can specify the
> additional module classes when creating the page tester.
>

Re: T5: Testing - PageTester reworked... How do I use mock services now?

Posted by Howard Lewis Ship <hl...@gmail.com>.
It's a good point. What you need to do is define a module that defines your
mock services, and contributes overrides into the Alias or AliasOverride
service configuration, such that your
mock services are used instead of the normal ones.  You can specify the
additional module classes when creating the page tester.

On 5/27/07, Otho <ta...@googlemail.com> wrote:
>
> Hi all!
> I followed the TestNG example with service replacements on the Tapestry
> home
> page only to find out that PageTester was reworked and now doesn't support
> a
> map with replacements anymore. I was unable to find any documentation in
> the
> changelogs or the mailinglist about why this was changed and how to use
> mock
> services with a PageTester right now.
>
> Start page depends on a spring service and this doesn't get injected
> automatically. So if I want to test it I have to somehow inject a Mock in
> there, or did I get something wrong?
>
> Regards,
> Otho
>



-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com