has announced the release of TestNG 5.0
. Inspired by JUnit
, TestNG has been the result of a lot of hard work on his part. His goal has always been to make testing easier and in this release he has further exploited many of the new Java language features to ease test development even further.
As expected for a tool of this nature, TestNG 5.0 relies heavily on annotations to specify the role of a method. In the announcement Cedric explains the work that he did to make the annotations cleaner in this release.
It is more obvious that configuration annotations should not mix with each other. That's a downside of the approach I initially chose: while it is legal to specify several booleans (@Configuration(beforeSuite = true, beforeTest = true)), it doesn't make a lot of sense, and the shorter version [@BeforeSuite] makes this a bit clearer.
Reporting has also been improved by having each distinct test suite end up in its own output directory. The new output directory contains an index.html to provides composite view of all tests that were run as well as a pointer back to the testng.xml that was used to drive the process. Cedric has also applied some CSS to improve the look of the reports.
Other features include; two attributes for the @Test annotation to direct the output to a specific report, the movement of @ExcpectedExceptions to be an attribute of @Test, and friendly stack traces that optionally show you all of the details if you so desire to see them.
The change log as reported by Cedric is;
- Stack traces can be interactively shown in the HTML reports
- Link to testng.xml in the reports
- Ant task: support for JVM, workingDir, timeout
- New structure for reports, suites go in their individual directory
- @Test(suiteName) and @Test(testName)
- The stack traces in reports do not include TestNG frames (system property testng.exception) see: http://groups.google.com/group/testng-dev/browse_thread/thread/9f4d46ade10b0fda)
- Exit with error when no methods are run (see: http://groups.google.com/group/testng-dev/browse_thread/thread/3c26e8a5658f22ac)
- List of methods in alphabetical order
- Class-scoped annotations were not recognized when inherited
- Deprecated @Configuration and introduced @BeforeSuite/Test/Class/TestMethod
- Deprecated @ExpectedExceptions and moved it into @Test
- expectedExceptions to @Test, deprecated @ExpectedExceptions
- New annotations: @BeforeSuite, @BeforeTest, etc...
- Was returning an exit code of 0 if a cyclic graph was detected
- Interface org.testng.ITest so that tests can declare a name
- Fixed: The Text reporter was reporting the square of the actual number of methods
- Bug reported by Eran about dependencies with an afterClass method
- IHookCallBack now receives the ITestResult in its run() method
- Name of suite for command line can be set with -Dtestng.suite.name=xxx
- TestNGAntTask was hardcoding m_haltOnFSP to true
- Passing a null parameter caused an NPE in the reports
- "listener" to the ant task (and documentation)
- if patch-testng-sourcedir.properties is found in the classpath with a property "sourcedir" containing a ; separated list of directories, this list will override -sourcedir.