I am a software engineer at Google on the Android project and the creator of the Java testing framework TestNG. When I'm not updating this weblog with various software-related posts or speaking at conferences, I am busy snowboarding, playing squash, tennis, golf or volleyball or scuba diving. Cedric is a DZone MVB and is not an employee of DZone and has posted 90 posts at DZone. You can read more from them at their website. View Full User Profile

Eclipse and TestNG: the Next Next Generation

11.03.2010
| 7206 views |
  • submit to reddit

 

I have been adding a steady amount of improvements to the TestNG Eclipse plug-ins over the past weeks, so I thought I’d stop for a minute and put together a quick summary of the upcoming features.

Better tree

The first improvement is the appearance of the tree. You will notice that it now mirrors faithfully the hierarchy that is found in testng.xml: Suites, Tests, Classes and then Methods. Failures are captured in the “Failed Tests” tab for easier look up:

This tab allows you to focus on the tests that fail and ignore all those that passed.

Search

Another new feature is the Search box. When you have hundreds of tests running, finding a specific one is not always easy, so you can now type a few letters of the test method or its parameters and the content of the tree will automatically narrow down to methods matching your search. Note in the screen shot above that the search also works on parameters provided by @DataProvider.

Summary tab

There is now a new tab called “Summary”. This tab gives you statistics on your test run, such as the timings, the test names, the number of methods and classes, etc… Since the results are shown in a table, you can also sort on any criterion you like for easier parsing. This is especially handy when you are trying to determine what tests take the longest time.

Of course, the search box works in this view as well, and note that in the screen shot below, the Time column is sorted in decreasing order:

This view is still a work in the progress and I’m planning to add more information there in the future, such as statistics on individual classes, time line, etc… Let me know if you have suggestions.

Better conversions from JUnit 3

I also improved the automatic conversion of JUnit tests and added support for JUnit 4 conversions. The screen shot above shows how deep the JUnit 3 quick fix now goes. Notice that your code is now correctly updated so that the converted file will compile without additional changes on your part.

… and JUnit 4

When I started writing the conversion fixes, I made support JUnit 4 a non-goal since I was under the impression that developers would be converting from JUnit 3 but that JUnit 4 users would probably not see the need to convert to TestNG.

Well, I was wrong, and since I started receiving requests from JUnit 4 users to help them convert over to TestNG, I went ahead and added quick fixes for JUnit 4 classes. The screen shot above illustrates this.

There are also a lot of other more subtle changes, but I’ll stop here. With these improvements, I’m hoping that the TestNG Eclipse plug-in will become even more appealing as the central hub for all your testing needs.

I will be pushing these new features to the update site very soon.

Published at DZone with permission of Cedric Beust, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Nicolas Frankel replied on Wed, 2010/11/03 - 3:47am

TestNG rocks and so does the Eclipse Plugin. Keep up the good work, Cedric!

Hantsy Bai replied on Wed, 2010/11/03 - 12:30pm

But the testng NetBeans plugin is still not accepted by NetBeans...it is in the contrib repository and not available in NetBeans release(and release update site).

I hope there is a robust testng plugin available for NetBeans users...

Manuel Jordan replied on Fri, 2010/11/05 - 11:24am

Thanks Cedric for your effort

Cedric Beust replied on Fri, 2010/11/05 - 11:49pm in response to: Hantsy Bai

Hantsy, I'm afraid the work on the NetBeans TestNG plug-in has stalled, I haven't heard anything about it for quite a while.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.