Which Java unit testing framework suits you best? JUnit, TestNG, JTiger…?

JUnit 4.0 was released recently with hardly any fanfare. It appeared for download on SourceForge well before the official site junit.org reported its release. While JUnit was the parent framework that started the whole test driven development wave, the response to JUnit 4 has been mixed.

The highlights of JUnit 4 are:

* Test classes do not have to extend from junit.framework.TestCase.
* Test methods do not have to be prefixed with ‘test’.
* Assert methods stay the same.
*
Support for annotations

However JUnit was frozen for quite a while and during this time many other frameworks moved and offered superior features. Annotations support for example has been present in frameworks like JTiger and TestNG for some time.

JTiger creator Tony Morris in a recent interview said that “JUnit is not much more than a glorified if/else construct.” and the only reason to use JUnit is if your code must run in a version prior to J2SE 5.0. However these comments were made prior to JUnit 4.0

So where do things stand today? Is JUnit the best choice because of its wide spread use, the wide IDE support and the easy availability of JUnit aware developers? Or should you adopt a framework like JTiger or TestNG?

Related:
>> Let’s Use JUnit
>> Why pick JTiger Java Unit Testing Framework over good old JUnit?
>> JUnit Books
>> Software Testing Books

Content Team

The IndicThreads Content Team posts news about the latest and greatest in software development as well as content from IndicThreads' conferences and events. Track us social media @IndicThreads. Stay tuned!

0 thoughts on “Which Java unit testing framework suits you best? JUnit, TestNG, JTiger…?

  • March 20, 2006 at 9:27 am
    Permalink

    Despite trying to use these unit test frameworks many times, I never managed to get them useful quickly on J2EE applications and then just dropped the thing and went back to manual testing and using main methods.

    These frameworks are fine for stand alone java applications but do they really work for major J2EE applications with app servers / DB and what not already making things chaotic enough?

  • March 20, 2006 at 4:22 am
    Permalink

    TestNG Eclipse
    [URL=http://testng.org/doc/eclipse.html]http://testng.org/doc/eclipse.html[/URL]

    TestNG IDEA
    [URL=http://testng.org/doc/idea.html]http://testng.org/doc/idea.html[/URL]

    For basic testing both frameworks (JUnit and TestNG) are good enough.

    but if you want customized testing for web based applications you need to consider things like [URL=http://jakarta.apache.org/cactus/]Cactus[/URL] [URL=http://httpunit.sourceforge.net/]httpunit[/URL] [URL=http://sourceforge.net/projects/strutstestcase/]Struts Test Case[/URL]

    [URL=http://opensourcetesting.org/unit_java.php]http://opensourcetesting.org/unit_java.php[/URL] has a list of various Java testing tools

  • March 7, 2006 at 7:45 am
    Permalink

    Breakout unlikely. Growth definitely.

    Geronimo’s administration capabilities look as good as many of the paid app servers. Are there any overall comparisons?

    What’s the difference between Geronimo and Websphere community edition?

Leave a Reply