码迷,mamicode.com
首页 > 编程语言 > 详细

springboot整合junit

时间:2020-04-21 13:36:47      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:int   http   直接   文件   image   src   run   info   scope   

对maven项目的pom.xml进行配置

 

<dependency>

    <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<!--junit5不需要配置junit-vintage-engine-->
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
测试类如图所示


技术图片

 

 junit5可直接扫描测试的主启动类 也不需要加@runwith注解 只需要加@SpringBootTest 注解 也不需要指定主启动类的class文件 

技术图片

 

 

测试如图



 

springboot整合junit

标签:int   http   直接   文件   image   src   run   info   scope   

原文地址:https://www.cnblogs.com/mc-74120/p/12743696.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!