February 27, 2006

Announcing TestNG 4.6

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() { ... }

  • 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.
     
  • 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:
  • @Test(description = "Verify that the server is up")
    public void serverShouldBeRunning() { ... }
  • 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).

Download TestNG at http://testng.org.

 

Posted by cedric at February 27, 2006 09:32 AM
Comments

This probably isn't very critical, but the plugin no longer works in Eclipse 3.2M5... This is the error: java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/junit/ui/TabFolderLayout

(I can totally imagine this isn't important to fix, just thought I would point it out)

Willem

Posted by: Willem Verstraeten at February 27, 2006 10:46 AM

Hi Willem,

Yes, we're aware of this, there is a bug filed in JIRA to that effect. We are waiting for the 3.2 API to freeze before we port the plug-in there, which was supposed to happen in M6 but might actually have happened in M5, so we'll be addressing this bug very soon...

Posted by: Cedric at February 27, 2006 10:51 AM

Thanks for including multithreaded testing feature!
That was really fast...

Posted by: Ruslan Zenin at February 27, 2006 12:05 PM

hi all,

I apologize for asking a forum question over here.

"Thanks for including multithreaded testing feature!"
is there a tutorial for this feature ?

thank you,

BR,
~A

Posted by: Anjan Bacchu at February 27, 2006 05:18 PM

Hi Cedric,

perhaps I'm an especially stupid user, but for months I'm unable to switch to TestNG because I can|t find a download link for the IDEA plugin on javaforge,

bye
-stephan

Posted by: Stephan Schmidt at March 1, 2006 12:24 AM

Solved, I used the IDEA plugin manager. stupid me.

Posted by: Stephan Schmidt at March 1, 2006 12:28 AM

Somehow google doesn't find anything usefull for TestNG and jMock, are the mocks evaluated after a test? how can I do this?

Thanks.

Posted by: Stephan Schmidt at March 1, 2006 02:41 AM

hi cedric,

i think your example for description is not very compelling.

how about
@Test(description = "Verify the server is up")
public void t1() { ... }

or even better
@Test(description = "initial data: left(x=10, y=20), right(x=10, y=23)")
public void t1() { ... }

as this simply can not be expressed naturally in a java method name.

ciao robertj

Posted by: robertj at March 1, 2006 07:31 AM

Are you getting these updated libraries into the central Maven 2 repository? Alternately, can you set up a repository for TestNG (and other toys)? It easy enough to change settings.xml to point to additional repositories.

Posted by: Howard M. Lewis Ship at March 2, 2006 05:48 PM

Are you getting these updated libraries into the central Maven 2 repository? Alternately, can you set up a repository for TestNG (and other toys)? It easy enough to change settings.xml to point to additional repositories.

Posted by: Howard M. Lewis Ship at March 2, 2006 05:48 PM

Oh my god, no plugin for NetBeans 5.0?

Posted by: pcdinh at March 14, 2006 07:26 PM

Hi Cedric:

Congratulations on the release.

I was interested in using the distributed testng features. When is the distributed testng work expected to be completed?

Thanks.

varun.

Posted by: Varun Rupela at March 23, 2006 09:53 PM

> jMock, are the mocks evaluated after a test?

Stephan, normally, jmock calls "verify" on all your mocks in the teardown method. However, you can call verify manually at the end of every test. This could be a big change if you've got a lot of jmock tests. Example:

Mock mockGui = mock(IGuiController.class);
Notifier notifier = new Notifier((IGuiController)mockGui .proxy());
mockGui.expects(once()).method("alert");
notifier.doStuff();
mockGui.verify(); // <-- add this line to force verify

There may be a better way to accomplish this with TestNG, but I don't know it well enough. You would also need a way to access a list of all mocks created in a test, which JMock must be doing internally, so that you can call "verify" on all of them.

Posted by: Jean at June 16, 2006 08:29 AM

I have posted about TestNG and JMock: http://themindstorms.blogspot.com/2006/08/more-on-jmock-and-testng.html.

And I am doing some work on this direction.

./alex
--
.w( the_mindstorm )p.
TestNG co-founder

Posted by: Alex Popescu at August 7, 2006 06:37 PM
Post a comment






Remember personal info?