Unit Test with JUnit
Tuesday, August 18, 2009
JUnit is a fancy term like AJAX which is used in java for testing purpose methods.
Please dont get afraid this code segment will tell you how it is simple.
dont think about code,get the concept.It is very simple.
I will show you one of the best answer I found from googling.
package real;
public class Real {
public String realMethod() {
return "Real, world";
}
public static void main(String[] args) {
Real h = new Real();
System.out.println(h.realMethod());
}
}
package real;
import junit.framework.TestCase;
public class TestReal extends TestCase {
public void testReal()
{
Real h = new Real();
assertEquals(h.realMethod(), "Real, world");
}
}
Please dont get afraid this code segment will tell you how it is simple.
dont think about code,get the concept.It is very simple.
I will show you one of the best answer I found from googling.
package real;
public class Real {
public String realMethod() {
return "Real, world";
}
public static void main(String[] args) {
Real h = new Real();
System.out.println(h.realMethod());
}
}
package real;
import junit.framework.TestCase;
public class TestReal extends TestCase {
public void testReal()
{
Real h = new Real();
assertEquals(h.realMethod(), "Real, world");
}
}
Labels:
JUnit