tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Stavrinides <P.Stavrini...@albourne.com>
Subject Re: IoC registry survives between JUnit tests?
Date Fri, 05 Dec 2008 16:09:00 GMT
Hi Howard

I use easymock and JUnit to test IoC services, would love to see some of your test code to
steal some of your ideas :o) is any of it available ? 

Peter

----- Original Message -----
From: "Christian Edward Gruber" <christianedwardgruber@gmail.com>
To: "Tapestry users" <users@tapestry.apache.org>
Sent: Friday, 5 December, 2008 8:53:22 AM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: IoC registry survives between JUnit tests?

Ah.  Got it.

Christian.

On 4-Dec-08, at 21:41 , Howard Lewis Ship wrote:

> My point was that it was possible the IoC was being re-initialized on
> each test and it wasn't noticeable because its very fast.
>
> On Thu, Dec 4, 2008 at 12:39 PM, Christian Edward Gruber
> <christianedwardgruber@gmail.com> wrote:
>> Oh, not a critique of startup or shutdown performance on T5-ioc,  
>> but more of
>> a general principle of unit testing components that participate in  
>> any IoC
>> container.  To test the component, you shouldn't need to use the  
>> container,
>> because it's a "unit" test.  But he said he was testing the wiring  
>> between
>> components anyway, rather than the functionality of the units, so  
>> my comment
>> isn't as relevant.
>>
>> Christian.
>>
>> On 4-Dec-08, at 15:23 , Howard Lewis Ship wrote:
>>
>>> I use a mix of techniques, using a lot of mocks for true unit tests,
>>> but also a lot of integration tests.
>>>
>>> I'm not sure what CEG has actually seen here; Registry.shutdown() is
>>> very dramatic, it tears apart the registry (releasing almost
>>> everything to the GC) and informs all of the proxies to shutdown as
>>> well.  Could he just be missing the re-creation of the services in
>>> later tests ... Registry startup is very, very fast once all the
>>> underlying classes are instantiated.
>>>
>>> On Thu, Dec 4, 2008 at 12:04 PM, Christian Edward Gruber
>>> <christianedwardgruber@gmail.com> wrote:
>>>>
>>>> FYI, in general, you shouldn't be using the container in your  
>>>> tests,
>>>> unless
>>>> you're testing the wiring itself.  You should be creating the
>>>> component/service under test, and constructing it with fakes.   
>>>> This isn't
>>>> absolute but there is a lot more effort/configuration/overhead if  
>>>> you
>>>> want
>>>> to use the container infrastructure in your unit test, and you  
>>>> start to
>>>> have
>>>> subtle interactions that might potentially make it more of an  
>>>> integration
>>>> test.  You risk testing more than one thing at a time.
>>>>
>>>> Christian
>>>>
>>>> On 4-Dec-08, at 01:28 , Stephan Schwab wrote:
>>>>
>>>>>
>>>>> Hi!
>>>>>
>>>>> I have several JUnit tests that instantiate
>>>>> org.apache.tapestry5.ioc.Registry via the RegistryBuilder before  
>>>>> tests
>>>>> run.
>>>>> Now I'm observing that services registered in one test are still
>>>>> available
>>>>> in other tests although I did call registry.shutdown(). My test  
>>>>> runner
>>>>> does
>>>>> not fork a new JVM.
>>>>>
>>>>> Calling registry.shutdown() should cause everything to vanish.  
>>>>> Is there
>>>>> anything that causes one-registry-per-JVM?
>>>>>
>>>>> Stephan
>>>>>
>>>>>
>>>>>
>>>>> -----
>>>>> --
>>>>> http://www.caimito.net - Caimito One Team - Agile Collaboration  
>>>>> and
>>>>> Planning
>>>>> tool
>>>>> http://www.stephan-schwab.com - Personal blog
>>>>> http://code.google.com/p/tapestry-sesame - Authentication  
>>>>> extension for
>>>>> Tapestry 5
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>>
>>>>> http://www.nabble.com/IoC-registry-survives-between-JUnit-tests--tp20828078p20828078.html
>>>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Howard M. Lewis Ship
>>>
>>> Creator Apache Tapestry and Apache HiveMind
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> -- 
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


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


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


Mime
View raw message