I am happy to announce the release of TestNG 4.6 (the Eclipse and IDEA plug-ins
have been updated as well). There are a lot of new features in this
release, here is a quick rundown:
- Method thread pools. TestNG was
already allowing you to run all your tests in parallel, and you can now use this
feature on individual test methods as well:@Test(invocationCount = 10, threadPoolSize = 3, timeOut = 10000)
public void f1() { … } - A new Reporter
API lets you log messages that will be reproduced in the HTML reports,
either on each individual method or as a combined output. - @Test now contains a description attribute that will also be included in the
final reports: - The reports have been considerably improved and now:
- Give a list of all the methods that didn’t run.
- Show all the methods with different colors based on their class.
- Use both relative and absolute timings, to make it easier to
cross-reference your tests with your logs. - List the parameters passed to each test method, if any.
You can see a full report sample
here.
- Writing your own reports has never been easier with the introduction of
the IReporter
interface. Only one method to override, it doesn’t get any easier
than this…
- @DataProviders can now know which test method they are
providing data for. If you declare the signature of your @DataProvider
with a java.lang.reflect.Method as first parameter, TestNG will
invoke it with the @Test method that is about to be executed.
This makes it easier for you to provide slightly different data based on the
current test method. See the
documentation for more details.
- Numerous bug fixes in the Eclipse plug-in (see the CHANGES file) and an
improved view of the results (see the picture at the beginning of this
post).
In this example, the method f1() will be invoked ten times from a pool made
of three threads. If any of these invocations fail to complete with ten
seconds, TestNG will abort the test and mark it failed. You can find more
information on this feature in
this article and in
the
documentation.
@Test(description = "Verify that the server is up")
public void serverShouldBeRunning() { … }
Download TestNG at http://testng.org.