26 June 2008

TestNG - Next Generation Java Testing
TestNG, written by Cedric Beust and Alexandru Popescu, is a light framework based on Java annotations (for J2SE 5.0) that allows you to design complex unit testing for J2SE 5.0 and J2SE 1.4. If you are interested in simplifying your unit-test cases, in leveraging J2SE 5.0 annotations to tag your test classes as well as being backward compatible with J2SE 1.4, in having out-of-the-box support for dependent methods and parallel and asynchronous testing, TestNG is the tool you are looking for.
In JUnit Multiple TestCase instantiations is a well-known issue. The setup() and teardown() methods are called before and after each test method; Although multiple TestCase instantiations might prove acceptable for simple test cases, what if you want to set up an object that is to be reused across more than one test method, for example, a Java Database Connectivity connection ? In this case, this is the one of the main advantage of TestNG. That is TestNG does not require static block initialization and has a flexible configuration scheme for handling test classes based on regular expressions and XML configuration files. TestNG does not instantiate the test class several times.
Also TestNG handle multithreaded unit testes. TestNG has multithreaded and parallel unit tests built in its core. You don't need to write specific code to handle multithreaded unit tests as they are just a configuration of TestNG.
TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use, such as:

- JDK 5 Annotations (JDK 1.4 is also supported with JavaDoc annotations).
- Flexible test configuration.
- Support for data-driven testing (with @DataProvider).
- Support for parameters.
- Allows distribution of tests on slave machines.
- Powerful execution model (no more TestSuite).
- Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...).
- Embeds BeanShell for further flexibility.
- Default JDK functions for runtime and logging (no dependencies).
- Dependent methods for application server testing.

Download : http://testng.org/doc/download.html