当前位置:网站首页>Postman基本操作
Postman基本操作
2022-06-21 16:00:00 【爆肝拳专业户】
一、Get请求
当请求方法为get时,请求参数应填在params中,以键值对的方式。
二、Post请求
当请求方法为post时,请求参数应填在body中。
x-www-form-urlencoded
对应于Content-Type头域为x-www-form-urlencoded的类型,是以键值对形式发送的表单参数,同时参数会携带在url中。form-data
对应于Content-Type的multipart/form-data类型,既可以发送键值对也可以进行文件参数传递。raw
raw选项中可以使用请求体原始格式编辑各Content-Type类型对应的参数格式,直接按请求体的格式来进行内容发送。如:Json、html等格式binary
binary选项用于发送文件内容请求。
三、环境变量
局部环境变量>全局环境变量
四、断言
请求前:
在 pre-request scripts 栏进行设置请求前置操作,如设置变量等。
1.点击 Get an environment variable(获取当前环境变量值)
#ipLoc为所设置的环境变量名
var ip=pm.environment.get("ipLoc");
console.log(ip);

2. 点击Set an environment variable(设置新的环境变量值)
注:环境变量名为ipLoc ,变量值为11.11.11.11
请求后:
在 Test 栏中通过编写代码来对状态码、响应头、响应正文等信息进行断言操作。
Status code: Code is 200(校验返回的响应状态码是否为200)
Response body: Containis string(检验返回的主体内容是否包含所需的字符串)
注:判断返回的结果中是否包含“美国”,若有,则输出提示符:“在返回结果主体中包含美国字符”。
Response body: JSON value check(判断返回结果的json内容中所指定的键对应的值是否为所预期的字符值)

Reponse body:Is equal to a string(校验返回结果的内容是否完全相等)Response headers:Content-Type header check(校验返回结果中头域信息)
Response time is less than 200ms(校验响应时间)
五、测试集
运行测试集:即同时运行多个接口测试。

六、数据驱动
即运行多个请求参数保存在格式为csv中的外部文件。
断言:
运行run
注意:
当出现乱码时,用Notepad++将csv文件格式转为UTF-8编码。
如:
测试结果:
边栏推荐
- svn与vss的区别有哪些
- Wechat applet -image is displayed in the image loading tool, but not in the real machine
- Standing at the digital tuyere, how can tooling enterprises' fly up '
- Web page automation practice "1. use the PY third-party library selenium to complete the access operation of elong"
- 互联网公司做单元测试吗?银行的需求有必要做单元测试吗?
- 【直播预告】6月24日 19点 HCSD大咖直播--就业指南,针对即将到来的秋招和暑期实习,带你梳理面试要点~~
- Web page automation practice 4. get the name, price and rating information of all hotels and write them into the file
- 强化学习入门项目spinning up(1)安装
- 关于规范共有产权住房出租管理工作的通知(试行)
- Advanced performance test series 6. problem solving and application development
猜你喜欢

招募令|数据可视化开发平台“FlyFish”「超级体验官」招募啦!

Recruitment order | data visualization development platform "flyfish" and "super experience officer" are recruited!

Cloud native monitoring system - Nightingale's recent list of new functions to solve multiple production pain points

AutoK3s v0.5.0 发布 延续简约和友好

Cloud native hybrid cloud network interconnection
Go语言开发代码自测绝佳go fuzzing用法详解

7 tips for writing effective help documents

VNC Viewer方式的远程连接树莓派

之前的装机记录

Huawei cloud releases desktop ide codearts
随机推荐
addslashes,stripslashes
重磅丨国内首份呈现数据库发展历程的图鉴正式发布!
关于修订《北京市共有产权住房规划设计宜居建设导则(试行)》的通知
The first atlas showing the development history of the database in China was officially released!
ESP8266/ESP32 通過TimeLib庫獲取NTP時間方法
Rely on the robustness of trusted AI to effectively identify deep forgery and help banks fight identity fraud
之前的装机记录
Which futures company is better to open an account at present? Is the service charge low and the transaction safe?
聪明人:三不管、四不说、五不帮,古人为人处世之道
Some understanding of cookies and sessions
Growth is not necessarily related to age
Notice on printing and distributing the Interim Measures of Beijing Municipality for the administration of housing with common property rights
PingCAP 入选 2022 Gartner 云数据库“客户之声”,获评“卓越表现者”最高分
【观察】微软“云+端”全面创新,让混合云更简单、更灵活、更安全
Typescript (6) function
Deep understanding of zero copy technology
强化学习入门项目spinning up(1)安装
Implementation and landing of any to any real-time voice change RTC dev Meetup
Cisco(59)——Hub&Spoke MPLS
In 2022, the number of mobile banking users in Q1 will reach 650million, and ESG personal financial product innovation will be strengthened