单元测试在3.8版本以前只需要导入一个jar包,3.8版本以后需要导入二个jar包.(网址:http://junit.org/junit4/)

 

package com.huawei.junit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TestJunit {

@Before
public void test1(){
System.out.println("test1");
}
@After
public void test2(){
System.out.println("test2");
}

@Test
public void say(){
System.out.println("this is a say method");
}
@Test
public void say1(){
System.out.println("TestJunit.say1()");
}
}