spring boot 单元测试

//关于注解
@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 次

Add a Comment

邮箱地址不会被公开。 必填项已用*标注