Phil Zoio wrote
an interesting article describing his experience porting a JUnit extension (DBUnit)
over to TestNG.
The bottom line: it’s very easy.
The nice thing about JUnit extensions is that they usually interface with
JUnit in a very simple manner: by providing their own base class (which
you need to extend) and their own setUp()/tearDown() methods (which you need to
call in your own setUp()/tearDown()). And this if course
very easy to emulate with TestNG.
With that in mind, using existing JUnit extensions with TestNG is
straightforward, as Phil convincingly demonstrates.
Phil actually went
even further and leveraged the finer TestNG @Configuration methods to provide a
DBUnit
TestNG extension that’s even more flexible than its JUnit counterpart.