JUnit Still Not Dead
One framework which is often compared to JUnit is TestNG, a testing framework inspired by JUnit. Michael Minella provides a brief but useful comparison between JUnit and TestNG.
| Feature | JUnit | TestNG |
| User Defined Life Cycle | ![]() |
![]() |
| Test Organization (groups, etc) | ![]() |
|
| Distributed Test Execution | ![]() |
|
| Parallel Test Execution | ![]() |
|
| Data Driven Tests | ![]() |
|
| Dependency Testing | ![]() |
|
| IDE Integration | ![]() |
![]() |
| Ant Integration | ![]() |
![]() |
| Maven Integration | ![]() |
![]() |
| Domain Specific Extensions (Database, HTTP, etc) | ![]() |
|
| Active Community | ![]() |
![]() |
To summarize his thoughts, JUnit has been adopted and extended more so than TestNG, however, TestNG seems to offer more functionality and has the ability to invoke JUnit tests, making it a tempting choice in testing frameworks.
In conclusion, JUnit may not be in the spotlight as much as it was a year ago, but is it really walking closer towards the 'bright light'? What do you think, what does the future have in store for JUnit?
I do think TestNG is better
by
许 晓斌
*infamous*?????
by
Artur Karazniewicz
"*infamous*"? Did the Author smoke something Yesterday?.. Since when JUnit is infamous? Did I miss something?
Also above comparison of JUnit and TestNG is little bit unfair, IMHO.
IDE integration of JUnit is usually far, far ahead than TestNG. It usually comes with Your IDE, right there, build in, with all the goodies. I can simply pres my favurite keystroke and have test stub done for me. I can see reference for all my test, every coverage tool comes with support for JUnit, every CI server comes with integration fo JUnit...
Second, there are *gazilions* of plugins and JUnit integrations basically for everything You could even think about.
Last but not least - xUnit is supposed to be a *simple* tool. Just do the things it's supposed to do - Unit Test Your code. Lots of extra features TestNG has, for 80% of usages, are useless. Or at least I lived without them for last ten Years.
Artur
Assumptions based on web statistics???
by
Guillaume Bertrand
JUnit is a mature framework, that many people use and that comes integrated in your IDE (as Artur rightly pointed out). I, for one, have been using JUnit for many years and I don't think I visited the website more than once (twice if you include today's visit for the sake of my argument); I just update my Eclipse regularly and JUnit gets updated along the way!
If need be, I am happy to visit the JUnit website every time I run a test :)
Re: *infamous*?????
by
Michael Stachel
... Lots of extra features TestNG has, for 80% of usages, are useless. Or at least I lived without them for last ten Years.
This is the same kind of statement in the opposite direction as you did with asking whether the author did smoking something. So I answer you: "Have you lived behind a rock the last ten years or is your code being tested only "Hello World" stuff? :-)
I recommend you take a look at TestNG and then come up with something more substantial. It is good that you defend your choice but without making claims which proves nothing.
Michael
Re: *infamous*?????
by
Mark Levison
TestNG - wants to be a unit testing tool and a whole lot more.
Neither is perfect, both make useful tools. Zealotry doesn't serve any of us well. I keep both tools in my arsenal and am agnostic as to which one I use.
Also contrary to the belief of some Junit is still actively developed and evolving.
Minor nit with the article: It can be argued that Dependency testing etc are not unit testing and hence the reason that its been left out of JUnit.
Also the claims that Cedric has made with respect to his influence of JUnits adoption of the NUnit like attributes have turned off more than a few members of the community.
JUnit is far from dead
by
Michael Minella
Re: JUnit is far from dead
by
craig w
I used "infamous" to indicate that JUnit is so widely known. Quite often if you ask a Java developer about unit testing JUnit is at least one of the tools they use or have heard of. And the comparison between JUnit and TestNG was meant to provide "brief" overview, not saying it was perfect or completely unbiased.
It is true that there are lot of extensions (I did make a reference to it near the end of the article).
@Mark
I agree I thinking having both in your tool belt is a good idea, as a developer, we should be open minded and adopt whatever works best for the work we are doing.
Re: JUnit is far from dead
by
Kurt Christensen
in·fa·mous
–adjective
1. having an extremely bad reputation: an infamous city.
2. deserving of or causing an evil reputation; shamefully malign; detestable: an infamous deed.
Re: *infamous*?????
by
Artur Karazniewicz
Artur
Re: JUnit is far from dead
by
Bernd Eckenfels
Re: JUnit is far from dead
by
Sai Venkatakrishnan
infamous?
by
Etienne L
xUnit as "The Camel's Nose"
by
Paul Nelson
It's very cool having experience in a tool transfer so seamlessly to other languages, and has significantly reduced my learning curve for new programming languages, frameworks and libraries. I hope xUnit's ubiquity insures it's long-term success (I think it will)... at least until something else becomes as pervasive.
TestNG
by
Joshua Partogi
Re: *infamous*?????
by
James Williams
James
www.jameswilliams.com.au
Re: TestNG
by
James Williams
James
www.jameswilliams.com.au
Re: TestNG
by
Morten Hattesen
I find that easier than fiddling around in xml files.
Junit ...infamous...
by
Amin Mohammed-Coleman
By the way..JUnit is certainly not infamous...
Search statistics are not the way to measure a mature tool popularity
by
Fernando Lozano
Re: TestNG
by
Robin de Silva Jayasinghe
Educational Content
Writing Usable APIs in Practice
Giovanni Asproni May 19, 2013





Hello stranger!
You need to Register an InfoQ account or Login to post comments. But there's so much more behind being registered.Get the most out of the InfoQ experience.
Tell us what you think