I’m happy to announce the release of TestNG 5.9. A lot of bug fixes went into this release, and a few noteworthy new features:

  • Parallelism can now be specified on classes. In the previous versions, you could specify either a setting of "methods" (every test method will be run in its own thread) and "tests" (all the methods in a given <test> tag will be run in the same thread but each <test> tag will run in its own thread). The new "classes" setting extends this functionality to test classes: all the test methods in the same class will run in the same thread but each class will have its own thread. Of course, the thread pool size and time out for these three settings are configurable.
  • You can now specify a time-out on @Test methods that use the invocationCount attribute. This way, you can specify that a test method should be invoked fifty times but that the maximal time allowed for these fifty invocations is ten seconds. If the invocations don’t complete in time, the test will be marked as failed.

  • A few new interfaces to assist developers who use the TestNG API: IAnnotationTransformer2 extends the annotation modification capabilities to more than just @Test and IInvokedMethodListener, which gives you additional monitoring on what test method is being invoked and when.

A lot of people have contributed patches, fixed and improvements for this release, and their names can be found in the full release notes below. Thank you all!

Release notes for TestNG 5.9

  • Added: New ant task boolean flag: delegateCommandSystemProperties (Justin)
  • Added: skipfailedinvocations under <suite> in testng-1.0.dtd (Gael Marziou / Stevo Slavic)
  • Added: -testrunfactory on the command line and in the ant task (Vitalyi Pamajonkov)
  • Added: TESTNG-298: parallel="classes", which allows entire classes to be run in the same thread
  • Added: @BeforeMethod can now declare Object[] as a parameter, which will be filled by the parameters of the test method
  • Added: IAnnotationTransformer2
  • Added: @Test(invocationTimeOut), which lets you set a time out for the total time taken by invocationCount
  • Added: IInvokedMethodListener
  • Added: -testjar supports jar file with no testng.xml file
  • Fixed: IInvokedMethodListener wasn’t properly recognized from the command line (Leonardo Rafaeli)
  • Fixed: TESTNG-309 Illegal default value for attribute in DTD file
  • Fixed: TESTNG-192: JUnit XML output includes wrong tests (Aleksandar Borojevic)
  • Fixed: Set a generated suite to default to non-parallel (Mark Derricutt)
  • Fixed: -testJar command line parsing bug
  • Fixed: testng-failed.xml didn’t include the listeners
  • Fixed: annotation transformers were not run when specified in testng.xml
  • Fixed: TESTNG-192: JUnit XML output includes wrong tests (Borojevic)
  • Fixed: @Parameters was not working correctly on @BeforeMethods with @DataProvider used on @Test methods
  • Fixed: testng-failed.xml was sometimes incorrectly generated (Borojevic)
  • Fixed: TESTNG-228: Assert.assertEqualsNoOrder
  • Fixed: TESTNG-229: Assert.assertEquals does not behave properly when arguments are sets
  • Fixed: TESTNG-36: assertEquals(Collection actual, Collection expected, String message) may have bug
  • Fixed: TESTNG-296: Malformed jar URLs breaking -testJar
  • Fixed: TESTNG-297: TestNG seemingly never stops running while building failed test suite (Gregg Yost)
  • Fixed: TESTNG-285: @Test(sequential=true) works incorrectly for classes with inheritance
  • Fixed: TESTNG-254: XmlSuite toXML() ignores listeners
  • Fixed: TESTNG-276: Thread safety problem in Reporter class
  • Fixed: TESTNG-277: Make Reporter.getCurrentTestResult() public
  • Fixed: Potential NPE in XmlTest#getVerbose (Ryan Morgan)
  • Fixed: EmailableReporter only displayed the first group for each test method
  • Fixed: time-outs were not working in <test> and <suite>
  • Fixed: @BeforeTest failing in a base class would not cause subsequent test methods to be skipped
  • Fixed: TESTNG-195: @AfterMethod has no way of knowing if the current test failed
  • Fixed: TESTNG-249: Overridden test methods were shadowing each other if specified with <include>
  • Fixed: DataProviders from @Factory-created tests were all invoked from the same instance
  • Fixed: enabled was not working on configuration methods
  • Fixed: IIinvokedMethodListener was not correctly added in TestNG
  • Fixed: NPE in XmlSuite#toXml
  • Fixed: TESTNG-231: NullPointerException thrown converting a suite to XML (Mark)