6 Years
Discussion Span
Last Post by krishnisilva

Well, the basics are quite simple. In junit 4 you annotate your test methods like the following. Your class doesn't have to extend anything.

public class SimpleTest {
   public void aTestCase() {
      //Some test code...

In Junit 3 you method name has to end with Test and the class has to extend TestCase.

public class SimpleTest extends TestCase {
   public void aSimpleTest() {
      //Some test code...

I would recommend starting with Junit 4 right away. It's easier in my opinion. Especially when setting up test suites. Just google Junit 4 tutorial.

Regarding netbeans and other IDE:s, There are probably plugins that make creation of test classes and stuff a bit faster, google that.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.