hi could someone help me in giving a tutorial in learning how to write testcases in java.
would preffer in netbeans if eclipse dosen't matter,

thanks in advance

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 {
   @Test
   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.

You of course also have to import some Junit classes in both cases.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.