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:
@Listeners(EmailableReporter.class) 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:
Core
- 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)
Eclipse
- 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
#1 by Mohamed Mansour on March 27, 2010 - 2:56 pm
Awesome work Cedric! Looking forward to using @Listeners 🙂
#2 by Sascha Schwarze on March 28, 2010 - 8:41 am
Hi Cédric, I think the ZIP file is missing the testng-5.12.jar file.
Pingback: TestNG 5.12 | Edit - Il blog di HTML.it
Pingback: Pedro Newsletter 25-31.03.2010 « Pragmatic Programmer Issues – pietrowski.info
#3 by Tom on April 14, 2010 - 10:22 am
Cedric, I think the priority parameter of @Test is not working. Is any additional configuration required with this?
Pingback: TestNG 5.12 Available for Maven Users « Brett Porter
#4 by Elisha Ebenezer on May 6, 2010 - 11:35 am
Hi Cedric,
I was trying to push for using TestNG in our project. And my company as for SHA-1 or MD5 checksums or a certificate to verify the integrity of the files downloaded. Can you please update the checksum information on your site. This will help me to pursuade my company for using testng in our project. Also, it helps to cross-check the integrity of downloaded file.
Thanks,
Elisha Ebenezer
#5 by Scott Yancey on July 11, 2010 - 9:17 pm
I’m using Eclipse plugin version 5.12.06 and I still can’t resolve the issue you list here as being resolved:
“Fixed: @Test(groups = [constant]) was taking name of the constant instead of its value. ”
When I select my group name(s) in the launch config, no tests end up being run. Is there something else that needs to be done here? Here’s my class annotation:
@Test(groups={TestGroups.ALL, TestGroups.CUSTOMER})
#6 by Scott Yancey on July 12, 2010 - 4:12 pm
I should have clarified in my post above that when I use the following syntax:
@Test(groups={“All”, “Customer”})
Then the tests are recognized and executed properly.
#7 by suar on November 23, 2010 - 8:06 am
Hi Cedric,
I’m using data providers(10 inputs), when I run the tests, report is having duplicate results
10 test are pass is appearing ten times
#8 by Peg Rhodes on April 21, 2011 - 10:51 am
I really like the new file wizard makes adding classes with annotation so much easier and works pretty slick thanks