springboot单元测试配置

时光怂恿深爱的人放手 提交于 2020-08-08 06:43:40

##SpringBoot进行单元测试 ####需要的依赖

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-test</artifactId>
	<scope>test</scope>
	<exclusions>
		<exclusion>
			<groupId>org.junit.vintage</groupId>
			<artifactId>junit-vintage-engine</artifactId>
		</exclusion>
	</exclusions>
</dependency>
<dependency>
	<groupId>junit</groupId>
	<artifactId>junit</artifactId>
	<scope>test</scope>
</dependency>

####创建测试类

@RunWith(SpringRunner.class)
@SpringBootTest(classes = BookApplication.class)
public class MyTest{
      @Test
      public void test(){}

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!