Postman测试接口
来源:互联网 发布:手机网络运营商无服务 编辑:程序博客网 时间:2024/06/14 00:57
引言
这一周最大的收获就是,接手新项目,整理业务需求,并做API接口测试。最开始项目中用到的是Postman。接下来介绍postman的简单实用。Postman: The Complete API Development Environment。
方法
(1) 查询返回的内容是单个实体的以find开头 比如:T findById(String id);(2) 查询返回的内容是实体集合 以select或query开头selectByExample(@Param("example")TExample example)queryByExample(@Param("example")TExample example)(3)查询返回内容非以上内容 以get开头
比如:查询返回的数量等 getCountByExample(@Param("example")TExample example)
改(put)
1、编辑角色信息 PUT 实体
代码:@RequestMapping(value = {"/updateTeacher"}, method = RequestMethod.PUT)@CrossOrigin@ResponseBodypublic ItooResult updateTeacher(HttpServletRequest request, HttpServletResponse response, @RequestBody StaffModel staffModel) {}
效果:
Postman测试步骤:
2、PUT 单个
代码:
@CrossOrigin@RequestMapping(value = "/updatePaymentRecordIspayById/{Id}", method = RequestMethod.PUT)@ResponseBodypublic ItooResult updatePaymentRecordIspayById(@PathVariable String Id){}
效果:
Postman测试步骤:
查(get)
1、GET / find
代码:
@RequestMapping(value = {"/findTeacherById"}, method = RequestMethod.GET)@CrossOrigin@ResponseBodypublic ItooResult findById(HttpServletRequest request, HttpServletResponse response, String StaffId) { }
效果:
Postman测试步骤:
2、query
代码:
@RequestMapping(value = {"/queryTeacherPage"}, method = RequestMethod.GET)@CrossOrigin@ResponseBodypublic ItooResult queryTeacherPageLike(HttpServletRequest request, HttpServletResponse response, String strLike,int pageNum, int pageSize) {}
效果:
Postman测试步骤:
增(post)
add
代码:
@RequestMapping(value = {"/addTeacher"}, method = RequestMethod.POST)@CrossOrigin@ResponseBodypublic ItooResult addTeacher(HttpServletRequest request, HttpServletResponse response, @RequestBody StaffModel staffModel) {}
效果:
Postman测试步骤:
删(delete)
1、删除 单个参数
代码:
@CrossOrigin@RequestMapping(value="/deleteLearningExperienceById/{Id}",method = RequestMethod.DELETE)@ResponseBodypublic ItooResult deleteLearningExperienceById( @PathVariable String Id) {}
效果:
Postman测试步骤:
2、删除 List集合
代码:
@RequestMapping(value = {"/deleteTeacher"}, method = RequestMethod.DELETE)@CrossOrigin@ResponseBodypublic ItooResult deleteTeacher(HttpServletRequest request, HttpServletResponse response, @RequestBody List<String> ids) {}
效果:
Postman测试步骤:
总结
前后端的接口规范,主要在于接口的参数书写是否正确,先实践找到正确的方法然后再深入理解。
阅读全文
0 0
- 接口测试工具(Postman)
- 接口测试利器-postman
- postman接口测试
- 接口测试之postman
- 接口测试之postman
- 接口测试之postman
- postman(接口测试)
- postman接口测试
- 接口测试常用工具PostMan
- postman接口测试
- Postman接口测试
- postman接口自动化测试
- 【接口测试工具】-Postman
- 接口测试工具-postman
- Postman测试接口
- 接口测试之postman
- Postman Postman接口测试工具使用简介
- http接口测试工具postman
- opencv识别圆形
- Requests使用
- 插入 | 希尔 | 冒泡 | 快速 | 选择 | 归并排序
- TreeMap实现原理及源码分析
- C语言实现进度条
- Postman测试接口
- 图论--倍增lca(一直没写代码实现)
- 《笨办法学python》加分习题21——我的答案
- 海里数据topk
- CCF 网络延时
- C++如何保留两位小数输出
- SQL 函数的使用
- 游戏角色
- spring boot hibernate