其实springboot集成junit测试很简单,无非是导入依赖,使用注解开发,都不需要任何配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
代码如下:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes=AppApplication.class)
public class TestReg {
@Autowired
UserService userServie;
Public void test(){
//Coding ....
}
}
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |