I do use Creator when I want to test listener methods, but I also want to use 
HtmlUnit to check the rendered output.  I don't know how to give my page the 
input it needs to render that output.  The pages in question derive the input 
from an injected service which draws the info from the database.  During 
testing, I am using an in-memory instance of HSQL which has no data in it at 
startup.  Am I totally misusing the tools here?

Thanks for your help,
Rob

-----Original Message-----
From: James Carman [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 07, 2006 7:47 AM
To: Tapestry users
Subject: Re: Testing pages

You shouldn't necessarily use HiveMind at all during unit testing.  How
would you propose that HiveMind inject a mock object?  Mock objects have
to be trained.  You'd have to write a special ServiceImplementationFactory
to create the mock object and train it just so HiveMind could inject it. 
That's overkill, IMHO.  I'd just use the Creator to create your pages.

> I don't know how, but somehow my original response wound up on the
> wrong thread.  Here is is:
>
> If you are using spring or hivemind to inject a service object into a
> page (and you should be), then it is simply a matter of modifying your
> applicationContext.xml or hivemodule.xml to inject your mock object
> instead of the real one.  Such functionality is one of the greatest
> strengths of IoC containers.
>
> --sam
>
> On 5/5/06, Rob Dennett <[EMAIL PROTECTED]> wrote:
>> Don't you have to run your application within the container in order to
>> use  HtmlUnit?  If so, when you create an instance of a page using
>> Creator, how do you make Tapestry use that instance to render the output
>> that you test with HtmlUnit?  Is there a way to attach it to the page
>> pool and guarantee that it is the one used?
>>
>> Thanks for your help,
>> Rob
>>
>> -----Original Message-----
>> From: James Carman [mailto:[EMAIL PROTECTED]
>> Sent: Friday, May 05, 2006 1:05 PM
>> To: 'Tapestry users'
>> Subject: RE: Testing pages
>>
>> When you use the Creator, you pass in a Map of properties.  I believe
>> the
>> map keys are the property names and the values are the values that the
>> Creator will bind to the properties.  So, you'd put your mock object
>> into
>> the map with the appropriate property name as the key.
>>
>> -----Original Message-----
>> From: Rob Dennett [mailto:[EMAIL PROTECTED]
>> Sent: Friday, May 05, 2006 1:55 PM
>> To: Tapestry users
>> Subject: RE: Testing pages
>>
>> Let's say that the page injects a service which has a routine called
>> getFoo
>> and that this routine calls upon the database for values to return.  Is
>> there a way that I can inject a mock service into my page rather than a
>> the
>> real service?
>>
>> Thanks for your help,
>> Rob
>>
>> -----Original Message-----
>> From: Henri Dupre [mailto:[EMAIL PROTECTED]
>> Sent: Friday, May 05, 2006 11:38 AM
>> To: Tapestry users
>> Subject: Re: Testing pages
>>
>> We implemented all our tests with HtmlUnit. I'm very happy with it. With
>> tapestry 4,  there is an id tag rendered with every component, it makes
>> it
>> very easy to test stuff with HtmlUnit!
>> I'm not sure what do you mean with mock services?
>>
>> Henri.
>>
>>
>> On 5/5/06, Rob Dennett <[EMAIL PROTECTED]> wrote:
>> >
>> > Can you test your pages using HtmlUnit with mock services?  I have a
>> > service that is drawing data from the database and I would like to
>> fake
>> that
>> > for testing purposes, but I can't figure out how to do it.
>> >
>> >
>> >
>> > Thanks for your help,
>> >
>> > Rob
>> >
>> >
>> >
>> >
>>
>> --
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.392 / Virus Database: 268.5.4/332 - Release Date: 5/4/2006
>>
>>
>> --
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.1.392 / Virus Database: 268.5.4/332 - Release Date: 5/4/2006
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> --
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.392 / Virus Database: 268.5.4/332 - Release Date: 5/4/2006
>>
>>
>> --
>> No virus found in this outgoing message.
>> Checked by AVG Free Edition.
>> Version: 7.1.392 / Virus Database: 268.5.4/332 - Release Date: 5/4/2006
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


James Carman, President
Carman Consulting, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/334 - Release Date: 5/8/2006
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to