TestNG is more flexible than JUnit... it does not require that you extend from a specific base-class for tests, nor does it require that you name tests starting with test*(), though JUnit 4.0 might have removed that restriction.

TestNG can also use an xml configuration file to control which tests are executed, so you can tailor a specific suite of tests easily. Supports groups, so you can adorn a set of tests as performance, or integration, then only run tests that are in the same group.

It also supports configuration injection, so you can use a config file to pass in test specific data to change the behavior of the tests with out needing to change code, blah, blah.

I did peep at the JUnit 4.0 stuff a while ago, but at the time it still seemed like TestNG was more powerful and flexible... as well as portable to older JDKs.

--jason


On Nov 21, 2006, at 1:19 PM, Prasad Kashyap wrote:

I don't know a whole lot of pros and cons of TestNG since I began
using it recently myself.

JUnit 3.8 didn't have a per-suite-once execution like TestNG
(@BeforeSuite and @AfterSuite) did. So we began using it.

JUnit 4.0 now does (@BeforeClass and @AfterClass) but yet it is highly
restrictive. The @BeforeClass has to be a public void static method
with no arguments. In our console-testsuite scenario, that wasn't of
much help to me.

I was told that there are other such nifty features but I'll let
someone more knowledgeable answer that.

Cheers
Prasad.

On 11/21/06, Jacek Laskowski <[EMAIL PROTECTED]> wrote:
On 11/21/06, Prasad Kashyap <[EMAIL PROTECTED]> wrote:
> Issue #2 is now fixed. All the tests in console-testsuites and
> deployment-testsuites now run and pass successfully. They continue to
> use TestNG. So these testsuites will serve as a good example for
> others wanting to use TestNG.

Will you be willing to tell us (me, particularly) what the pros and
cons of using TestNG are? In other words, shall we abandon junit for
testng completely because testng is what Geronimo, OpenEJB should be
using due to its better architecture, etc.? I'd like to give it a shot
in openejb and see how it could improve its bits.

Jacek

--
Jacek Laskowski
http://www.jaceklaskowski.pl


Reply via email to