1. 添加测试支持依赖:spring-boot-starter-test

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-test</artifactId>

<scope>test</scope>

</dependency>

注意:加入这个依赖之后,junit包就可以不用了,因为test的starter中包含了junit

 

 

@RunWith(SpringRunner.class) 启动支持类
@SpringBootTest 测试支持
public class TestController {

@Test  //测试方法
public void test(){

}

}
posted on 2018-06-14 10:56  java_zhao  阅读(251)  评论(0)    收藏  举报