On 2/19/06, Adam Winer <[EMAIL PROTECTED]> wrote:
Good point ... I'll go ahead and add it to the tearDown() method as well. It'll be in the 20060220 nightly build. Paranoid programming rulez :-)
The call is required in the setUp() method to make things work correctly on the *first* test, when you have the MyFaces implementation in the classpath of the tests. Calling it in tearDown() doesn't hurt anything, but protects test developers who try to subvert the JUnit test lifecycle stuff.
Craig
Purely speaking, FactoryFinder.releaseFactories() should
only be necessary in tearDown() - which is where it makes
the most sense, since releasing factories is cleanup, which
is the job of tearDown().
Practically speaking, it's simplest and safest to call it
in both methods - which means that your test is
doing the right thing (by calling it in tearDown() to clean up
properly), and is guarding against other tests doing
the wrong thing (by calling it in setUp()). If all tests
followed the rules, you'd only need to call it in one,
but you're better off not assuming that all tests will.
Good point ... I'll go ahead and add it to the tearDown() method as well. It'll be in the 20060220 nightly build. Paranoid programming rulez :-)
The call is required in the setUp() method to make things work correctly on the *first* test, when you have the MyFaces implementation in the classpath of the tests. Calling it in tearDown() doesn't hurt anything, but protects test developers who try to subvert the JUnit test lifecycle stuff.
-- Adam
Craig
On 2/19/06, Craig McClanahan <[EMAIL PROTECTED]> wrote:
>
>
>
> On 2/19/06, Dennis Byrne <[EMAIL PROTECTED] > wrote:
> > >I updated the Shale snapshots about half an hour ago... coincidence?
> > >Wendy
> >
> > This would have happened w/ or w/out your update.
> >
> > The fix for this was to put FactoryFinder.releaseFactories() in setup()
> and in tearDown() . This setup() call is to clear configured Factory info
> from previous tests ( which taints the first test of the current running
> TestCase ). The tearDown() call is to prevent interference w/ subsequent
> TestCases.
> >
> > In an offlist conversation, Sean and I recently came to the agreement that
> AbstractJsfTestCase should be calling FactoryFinder.releaseFactories() .
> This is important because AbstractJsfTestCase.setup() configures each
> Factory, and AFAIK, it was interfering w/ his tests, which were children of
> AbstractJsfTestCase. Sean ended up putting this in
> AbstractJsfTestCase.setup (), probably for the same reason it needs to now go
> in some of ours.
> >
> > @ Sean or Wendy or Craig - can one of you please put
> FactoryFinder.releaseFactories() in AbstractJsfTestCase.tearDown () also ?
>
> In the current code, FactoryFinder.releaseFactories() is called at the
> *beginning* of the setUp() method. Doesn't that make calling it in
> tearDown() redundant, because every test (including the first one) is going
> to call it as part of the setup process anyway?
>
> > Dennis Byrne
> >
> >
> >
> Craig
>
>
