RE: IoC registry survives between JUnit tests?
It's all in the subversion repository. http://tapestry.apache.org/tapestry5/source-repository.html > -Original Message- > From: Peter Stavrinides [mailto:[EMAIL PROTECTED] > Sent: 05 December 2008 16:09 > To: Tapestry users > Subject: Re: IoC registry survives between JUnit tests? > > 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" <[EMAIL PROTECTED]> > To: "Tapestry users" > 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 > > <[EMAIL PROTECTED]> 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 > >>> <[EMAIL PROTECTED]> 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 >
Re: IoC registry survives between JUnit tests?
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" <[EMAIL PROTECTED]> To: "Tapestry users" 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 > <[EMAIL PROTECTED]> 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 >>> <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] >>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>> >
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - 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] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - 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]
Re: IoC registry survives between JUnit tests?
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 <[EMAIL PROTECTED]> 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 >> <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>> >>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> >> >> -- >> Howard M. Lewis Ship >> >> Creator Apache Tapestry and Apache HiveMind >> >> - >> 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] > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IoC registry survives between JUnit tests?
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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - 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]
Re: IoC registry survives between JUnit tests?
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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IoC registry survives between JUnit tests?
Christian Edward Gruber-2 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. > It was about the wiring what I wanted to achieve. Not really a *unit* test. The approach is a bit similar as to what the PageTester does. As background info: I'm using Tapestry IoC outside of a Tapestry web application. - -- 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--tp20828078p20841474.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IoC registry survives between JUnit tests?
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IoC registry survives between JUnit tests?
Never mind. Apparently it's too late and I don't see my own mistakes. Sorry for wasting bandwidth. - -- 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--tp20828078p20828173.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IoC registry survives between JUnit tests?
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]