当前位置:网站首页>全网最详细的postman接口测试教程,一篇文章满足你
全网最详细的postman接口测试教程,一篇文章满足你
2022-07-06 09:24:00 【测试小婉】
目录
1、前言
之前还没实际做过接口测试的时候呢,对接口测试这个概念比较渺茫,只能靠百度,查看各种接口实例,然后在工作中也没用上,现在呢是各种各样的接口都丢过来,总算是有了个实际的认识。因为只是接口的功能测试,所以目前是用postman做测试,比较简便,当然这只是接口测试的入门而已,了解的只是冰山一角,后续会努力往接口压力、接口性能、接口自动化方向靠拢。
2、接口理论
我们常说的接口就是API,接口测试是测试系统组件间接口的一种测试。接口测试主要用于检测外部系统与系统之间以及内部各个子系统之间的交互点。测试的重点是要检查数据的交换,传递和控制管理过程,以及系统间的相互逻辑依赖关系等。
其实接口测试就和普通功能测试没什么区别,区别就是功能测试是在页面上输入值,提交数据看结果,而接口测试没有页面,通过接口规范文档上的调用地址,请求参数,拼接报文,然后发送请求,检查返回结果。
3、接口实例
一、POST
POST请求是用来发送数据的,下面以下XX系统分配加工厂为例
1、产品经理的PRD文档要求如下(分配加工厂接口的修改内容如下):
1) 分配加工厂接口里新增加工厂ID字段,整数类型,非必填;
2.)若对单领料单已经审核通过,限制只有待审核状态才能分配加工厂,若不是则提示“对单领料单不是待审核,不能分配加工厂”;
2、开发人员的接口文档如下:
接口名称:XX系统分配加工厂接口
接口路径:POST
/process/requisitionOrder/updateDistributeStatus
请求参数:
Headers:

Body:
{
"factoryId": "123",//加工厂ID
"factory": "XX服饰",//加工厂名称
"produce_order_id": [//生产制单(纯数字) 多个用,分开
1134360
]
}
返回数据:
{
"msg": "success",
"code": "0",
"info": "操作成功"
}3、测试人员的测试用例如下:

4、测试人员执行测试用例如下:
1)打开Postman,填写接口信息,具体操作如图
注:接口文档中的URL是不带环境地址的,所以将URL复制到地址栏时,前面还要加上环境的地址,比如测试环境的地址+接口URL,
当然如果有多个环境的话,可以用环境配置功能,具体配置步骤在第4)步进行描述。

2)结合测试用例,组合变换参数信息后,查看返回的JSON数据与PRD是否一致
3)测试用例遍历完成后,以上即完成了POST请求的接口功能测试。
4)这里描述一下postman的环境配置
第一步,如图

第二步,如图

第三步,如图

第四步,如图

第五步,如图(这是针对有多个环境的情况,比如一般都会有测试环境、验收环境、生产环境)

二、GET
GET请求是用来获取数据的,下面以XX系统获取出库账单为例,(以下只列出部分数据信息用于演示)
1、产品经理的PRD文档要求如下:

2、开发人员的接口文档如下:
接口名称:出库账单同步到XX系统接口
接口路径:GET
/purchase/prepareOrder/importListFromPlm
请求参数:
Query:

返回数据:
{
"msg": "success",
"code": "0",
"info": {
"list": [
{
"billNo": "ML201902205005", //账单编号
"billDate": "2019-02-20", //账单日期
"factory": "生产部萨文服饰-烨琳", //供应商名称
"materialSku": "16MLZS0513-628", //物料SKU
"num": 20, //数量
"purchasePrice": 0, //采购单价
"billSum": 0, //账单金额
}
]
}
}3、测试人员的测试用例如下:

4、测试人员执行测试用例如下:
1)打开Postman,填写接口信息,具体操作如图
注:接口文档中的URL是不带环境地址的,所以将URL复制到地址栏时,前面还要加上环境的地址,比如测试环境的地址+接口URL,
当然如果有多个环境的话,可以用环境配置功能,具体配置步骤可以参考POST的描述

2)结合测试用例,组合变换参数信息后,查看返回的JSON数据与PRD是否一致
3)测试用例遍历完成后,以上即完成了GET请求的接口功能测试

感谢每一个认真阅读我文章的人!!!
如果下面这些资料用得到的话可以直接拿走:
1、自学开发或者测试必备的完整项目源码与环境
2、测试工作中所有模板(测试计划、测试用例、测试报告等)
3、软件测试经典面试题
4、Python/Java自动化测试实战.pdf
5、Jmeter/postman接口测试全套视频获取
我个人整理了我这几年软件测试生涯整理的一些技术资料,包含:电子书,简历模块,各种工作模板,面试宝典,自学项目等。需要的评论区留言谢谢。
边栏推荐
- Pointer -- eliminate all numbers in the string
- ucore lab2 物理内存管理 实验报告
- ucore lab7 同步互斥 实验报告
- Matplotlib绘图快速入门
- Global and Chinese market of maleic acid modified rosin esters 2022-2028: Research Report on technology, participants, trends, market size and share
- Four methods of exchanging the values of a and B
- Software testing interview summary - common interview questions
- Pointer -- output all characters in the string in reverse order
- Rearrange spaces between words in leetcode simple questions
- The salary of testers is polarized. How to become an automated test with a monthly salary of 20K?
猜你喜欢

1. Payment system

安全测试入门介绍
![[Ogg III] daily operation and maintenance: clean up archive logs, register Ogg process services, and regularly back up databases](/img/31/875b08d752ecd914f4e727e561adbd.jpg)
[Ogg III] daily operation and maintenance: clean up archive logs, register Ogg process services, and regularly back up databases

ucore lab5用户进程管理 实验报告

Database monitoring SQL execution

The salary of testers is polarized. How to become an automated test with a monthly salary of 20K?

"If life is just like the first sight" -- risc-v

数字电路基础(三)编码器和译码器

The number of reversing twice in leetcode simple question

Fundamentals of digital circuit (V) arithmetic operation circuit
随机推荐
后台登录系统,JDBC连接数据库,做小案例练习
基于485总线的评分系统双机实验报告
Differences between select, poll and epoll in i/o multiplexing
My first blog
Fundamentals of digital circuit (V) arithmetic operation circuit
“Hello IC World”
Es full text index
Pointeurs: maximum, minimum et moyenne
Soft exam information system project manager_ Project set project portfolio management --- Senior Information System Project Manager of soft exam 025
Sleep quality today 81 points
With 27K successful entry ByteDance, this "software testing interview notes" has benefited me for life
王爽汇编语言学习详细笔记一:基础知识
[pointer] solve the last person left
Global and Chinese market of DVD recorders 2022-2028: Research Report on technology, participants, trends, market size and share
[pointer] find the length of the string
The maximum number of words in the sentence of leetcode simple question
指针--剔除字符串中的所有数字
Login the system in the background, connect the database with JDBC, and do small case exercises
Global and Chinese market of goat milk powder 2022-2028: Research Report on technology, participants, trends, market size and share
Install and run tensorflow object detection API video object recognition system of Google open source