Loading
JUnit Unit Testcase

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  JUnit Unit Testcase Example ?


Ans)

JUNIT is a very popular Unit Tesing API, this has been widely used
for performning Unit Testing.

Below are steps to follow for creating a JUNIT Test Case.

public class TestYourService extends TestCase {
 
 protected void setUp()  {
  try {
   super.setUp();
  } catch (Exception e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 
 }

 protected void tearDown() throws Exception {
  super.tearDown();
 }

 public void testYourMethod() throws ComergentException {
         TestService testService = new TestServiceImpl();     
         String result = testService.perform();
         assertNotNull(result);
         assertEquals("Success", result);
   }
}



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

JUnit Unit Testcase


JUnit Unit Testcase

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free