美文网首页
SpringBoot 单元测试

SpringBoot 单元测试

作者: 开挂的小怪兽 | 来源:发表于2019-06-24 14:24 被阅读0次

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注解:

image.png

相关文章

网友评论

      本文标题:SpringBoot 单元测试

      本文链接:https://www.haomeiwen.com/subject/pyznqctx.html