August 31, 2005

Porting JUnit extensions to TestNG

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.

Posted by cedric at August 31, 2005 02:33 PM
Comments

Would it be possible to write, for TestNG, a generic JUnitAdaptor, based on this work, that would suffice for a large percentage of similar JUnit extensions?

Posted by: Robert Watkins at August 31, 2005 04:27 PM
Post a comment






Remember personal info?