is there a way to run an instance/object of this type using Junit. The
reason is that I want to call setVar for setting var. junit can run
class but can it run an object of this class?
something like
import org.junit.*;
import org.junit.After;
import org.junit.Test;
import org.junit.Before;
public class TT {
private String var =null;
public setVar(String s){
var = s;
}
@Before
public void Before(){
}
@Test
public void tt(){
System.out.println("Test1" );
}
@Test
public void tt2(){
System.out.println("Test2" );
}
@Test
public void tt3(){
System.out.println("Test3" );
}
@After
public void After() throws Exception {
System.out.println("after");
}
}
Chris - 09 May 2007 23:16 GMT
> is there a way to run an instance/object of this type using Junit. The
> reason is that I want to call setVar for setting var. junit can run
> class but can it run an object of this class?
Yes, it's possible. Look at the javadoc for TestSuite:
TestSuite suite= new TestSuite();
suite.addTest(new MathTest("testAdd"));