SpringBoot 单元测试

时间:2020-07-13 18:48:01   收藏:0   阅读:65

SpringBoot 单元测试

依赖注入

引入依赖:

 <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-test</artifactId>
           <scope>test</scope>
</dependency>

  

这里引入了一个spring-boot-starter-test依赖,是springboot中写单测所需要的。
在单元测试类上添加@RunWith(SpringRunner.class)@SpringBootTest注解:

技术图片

 

转载来源:https://www.jianshu.com/p/18c57aaede7c
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!