SpringBoot测试进阶高级篇之MockMvc

MockMvc类的使用和模拟Http请求实战

        1、增加类注解 @AutoConfigureMockMvc
                                @SpringBootTest(classes={XdclassApplication.class})
        2、相关API
            perform:执行一个RequestBuilder请求
            andExpect:添加ResultMatcher->MockMvcResultMatchers验证规则
            andReturn:最后返回相应的MvcResult->Response

    

猜你喜欢

转载自blog.csdn.net/peng_0129/article/details/85005701