I’m happy to announce the release of TestNG 5.12.

The most important change is that JDK 1.4 and Javadoc annotations are no longer supported. If you are still using JDK 1.4, you will have to stick with TestNG 5.11.

The most notable new feature in this new release is the annotation @Listeners, which lets you add listeners directly in Java (no need for XML). Any TestNG listener (i.e. any class that extends ITestNGListener) can be used as a value for this annotation, except IAnnotationTransformer which needs to be known before TestNG starts parsing your annotations.

For example, suppose that one test class is failing and you want to share the full report with a coworker, you can use the EmailableReporter to generate a single HTML file that you can then email. All you need to do is add the following @Listeners annotation:

public class VerifySampleTest {
  // ...

and then run the class with TestNG, which will generate the following report:

I also made a few improvements to the Eclipse plug-in, such as a New File wizard:

You can download TestNG and the TestNG Eclipse plug-in at the usual places, and the new version will be available in the main Maven repository shortly. Here is the full change log for 5.12:


  • Removed: JDK 1.4 and Javadoc annotation support
  • Added: @Listeners
  • Added: IAttributes#getAttributeNames and IAttributes#removeAttribute
  • Added: testng-results.xml now includes test duration in the <suite> tag (Cosmin Marginean)
  • Added: Injection now works for data providers
  • Added: TestNG#setObjectFactory(IObjectFactory)
  • Added: Priorities: @Test(priority = -1)
  • Added: New attribute invocation-numbers in <include>
  • Added: testng-failed.xml only contains the data provider invocations that failed
  • Added: IInvokedMethodListener2 to have access to ITestContext in listeners (Karthik Krishnan)
  • Fixed: @Before* methods run from factories were not properly interleaved
  • Fixed: The TextReporter reports skipped tests as PASSED (Ankur Agrawal)


  • Added: New file wizard: can now create a class with annotations, including @DataProvider
  • Added: You can now select multiple XML suites to be run in the launch dialog
  • Fixed: @Test(groups = [constant]) was taking name of the constant instead of its value.
  • Fixed: The custom XML file is now created in the temp directory instead of inside the project
  • Fixed: In the launch dialog, now display an error if trying to pick groups when no project is selected
  • Fixed: Was not setting the parallel attribute correctly on the temporary XML file