1、IDE自带Junit jar包,使用前必须先导入,用法:
2、只可以运行@Test下的方法
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class TextJunit {
public static void main(String[] args) {
System.out.println("main!");
}
@Test
public void textjunit() {
System.out.println("hello junit!");
}
@Before
public void testBefore() {
System.out.println("before!");
}
@After
public void testAfter(){
System.out.println("after!");
}
}