1.使用相同的依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
2.Junit4测试
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest
@RunWith(SpringRunner.class)
public class Junit4Test {
@Before
public void testBefore(){
System.out.println("before..");
}
@Test
public void test1(){
System.out.println("test..");
}
@After
public void TestAfter(){
System.out.println