Over a million developers have joined DZone.

Announcing TestNG 5.12

DZone's Guide to

Announcing TestNG 5.12

· Java Zone
Free Resource

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

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: Issue 476 – NPE with Groovy Tests (Andrew Eisenberg)
  • 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


Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.


Published at DZone with permission of Cedric Beust, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}