2018-03-08
springboot-编写单元测试
springboot 评论:0 浏览:101

转载请注明出处:https://oldnoop.tech/c/162.html

引入的依赖

spring-boot-starter-test

springboot工程的模板测试类

使用sts或者idea创建的springboot

默认会有一个单元测试的模板类

示例如下

@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringbootDemoApplicationTests {

    @Test
    public void contextLoads() {
    }

}

springboot工程测试类添加注解

按照 模板 测试类 的写法, 就是加上如下两个注解

@RunWith(SpringRunner.class)

@SpringBootTest



  • 转载请注明出处:https://oldnoop.tech/c/162.html

Copyright © 2018 oldnoop.tech. All Rights Reserved

鄂ICP备2023022735号-1