1) JUnit is the de facto standard library for unittesting in Java 2) JUnit is supported out of the box by all major IDEs 3) JUnit has sh*tloads of extensions available for various purposes beyond unit testing plain old Java objects (HttpUnit, JWebUnit, XMLUnit, dbUnit, TagUnit, J2MEUnit, JFCUnit, JUnitPerf, Cactus, SQLUnit to name a few) 4) JUnit has great Ant integration via the <junit> and <junitreport> tasks Some folks have minor complaints about the restrictions JUnit enforces on your test code, but these issues tend to be really minor annoyances. In fact, most of the time the complaints come up because people try to use plain JUnit for things other than unit testing.
Originally posted by ashok ks: Why should i go for junit test classes instead of writing my own test classes for java?
This could be answered with a question: why should I use Eclipse instead of writing my own IDE? Most of the time, it makes sense to use an existing product instead of building your own. The main reasons for building your own are (1) significant overhead in learning the product, and (2) limitations of existing products. I doubt that the learning curve of JUnit is even close to that of building your own unit test framework, but eventually it's you who needs to make that call.