On 09-10-09 11:39 AM, Vladimir Blagojevic wrote:
TestNG starts from the leaf class and searches for a first class
that
has a method annotated with @AfterClass and invokes it. It does not
continue to climb the hierarchy. However, all needs to be done is to
invoke super from SingleCacheManagerTest and MultipleCacheManagerTest.
However, that said, we are still left with a bunch of test classes that
do not inherit from AbstractCacheTest :(
So yes, I'll see how to hookup UnitTestTestNGListener :)
Hard to believe but there is no way to do this through listener. After I
could not find a way to do it I even posted a question on testng-users
and got a recommendation from Cedric to nullify all instances from a
@AfterClass method in superclass.
I also found that I was wrong regarding invocation of @AfterClass
methods:) As long as you do not override @AfterClass method it *will* be
invoked starting from the leaf all the way up through ancestors. I
created a superclass called AbstractInfinispanTest with
nullifyInstanceFields method and made AbstractInfinispanTest superclass
of all test classes. Works as a charm and guranteed no more leaks!
Let me know if you have any reservations to this change.
Vladimir