记录下java的个人测试方法

IDEA,用 JUnitGenerator V2.​ 0 做单元测试。。
如果是 SpringBoot,测试类上面加注解
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = MySpringBootApplication.class)
MySpringBootApplication 是指 Application 启动类的类名。
然后再用 @Autowired 注入对象就可以测试服务层。
控制层用 postman 测试。

posted @ 2019-06-04 22:11  山岚  阅读(557)  评论(0编辑  收藏  举报