spring boot 单元测试
Posted On 2018年2月11日
//关于注解 @RunWith(SpringRunner.class) //SpringRunner 是 SpringJUnit4ClassRunner的一个别名 @SpringBootTest // springboot 集成测试的时候使用, 因为要使用springboot 的特性, 不适用mock的方式
@RunWith(SpringRunner.class) @SpringBootTest(classes = { Application.class }) public class ServiceTest{ @Autowired TestService testService; @Test public void testServer() { // 单元测试代码在这 } }
此篇文章已被阅读1654 次