Greg explains why he likes JUnit:
there are two things that make JUnit great:
- what they left out and
- the fact that it’s pretty much THE standard for writing unit tests
I certainly acknowledge point 2 since I provide a JUnit mode in
TestNG (read: I emulate JUnit’s bugs ). But you can’t possibly be serious about point 1, Greg, can you?
What is good about JUnit is what they left out?!?
Here is what happens
when a framework is not only simple but simplistic: people start fixing
its deficiencies on their own and you end up with an explosion of customized
tools built on top of it.
Witness the following email, that was posted on the Groovy mailing-list just
yesterday where Guillaume Laforge explains what they have added to JUnit to make
Moreover, there are some other convenient assert* methods:
- assertArrayEquals(Object expected, Object value)
- assertLength(int length, char array)
- assertLength(int length, int array)
- assertLength(int length, Object array)
- assertContains(char expected, char array)
- assertContains(int expected, int array)
- assertToString(Object value, String expected)
(by the way, the Groovy dudes have added some pretty cool JUnit stuff to
their shell, you should check it out)
I for one am glad not to have to deal with multiple frameworks.
That’s an interesting thought too. I tend to favor the other approach,
though: encourage people to be creative and come up with all sorts of
crazy ideas and frameworks, and let the market pick a winner. I mean…
are you really saying you wish there was Struts and only Struts?
Every new project you start on you’d be learning yet another testing
No, you are mixing up "concepts" and "implementations". The concepts of
unit testing are fairly basic and well-known, and even though TestNG and JUnit
offer two radically different approaches to this problem, they implement the
same idea and I’m pretty sure that a developer familiar with one will have no
problem switching to the other.
At any rate, my goal was to get people to rethink unit testing and question
what they consider for granted, so at least, TestNG was successful in that.
Finally, be sure to read
Mike’s recent blog entry, where he summarizes the main issues with unit
testing quite eloquently.