当前位置: 首页 > news >正文

网站界面类型官网站内推广内容

网站界面类型,官网站内推广内容,广州百度关键词排名,旅游网站建设推广目录 七、Postman 1、安装 2、postman的界面介绍 八、Postman执行接口测试 1、请求页签 3、响应页签 九、Postman的环境变量和全局变量 1、创建环境变量和全局变量可以解决的问题 2、postman中的操作-全局变量 1️⃣手动设置 2️⃣代码设置 3️⃣界面获取 4️⃣代…

目录

七、Postman

1、安装

2、postman的界面介绍

八、Postman执行接口测试

1、请求页签

3、响应页签

九、Postman的环境变量和全局变量

1、创建环境变量和全局变量可以解决的问题

2、postman中的操作-全局变量

1️⃣手动设置

2️⃣代码设置

3️⃣界面获取

4️⃣代码获取

3、postman中的操作-环境变量

1️⃣手动设置

2️⃣代码设置

3️⃣界面获取

4️⃣代码获取

十、接口关联

1、第一种方式:Json提取器

2、第二种方式:正则表达式提取器(项目实战中的Token鉴权使用到了)

 十一、Postman内置动态参数和自定义的动态参数

1、内置动态参数

2、自定义的动态参数

十二、Postman断言

1、常规断言:六种 

2、动态参数断言

3、全局断言


七、Postman

1、安装

【安装教程】postman下载及安装-CSDN博客

2、postman的界面介绍

Home主页
workspaces 工作空间

  • Collections:项目集合
  • APIs:api文档
  • Enviromments:环境变量,全局变量
  • Mock Server:虚拟服务器
  • Monitors:监听器
  • History:历史记录

八、Postman执行接口测试

下面以get请求为例,post请求参考视频:8.精通Postman之发送post请求及get和post的区别_哔哩哔哩_bilibili

Create Collection→输入集合名称→在集合处右键→点Add request→输入请求名称→设置请求方式为get/post→输入请求路径→(下面是一些GET请求页面的参数介绍)→send→(获得响应页签)

1、请求页签

①Params:get请求传参

②authorization:鉴权

③headers:请求头

④Body:post请求传参

  • form-data:既可以传键值对参数也可以传文件。
  • x-www-from-urlencoded:只能够传键值对参数。
  • raw :可以传输 json , text , xml, html , javascript类型数据。
  • binary:把文件以二进制的方式传参。

⑤pre-request-script:请求之前的脚本。

⑥tests:请求之后的断言。

⑦cookies:用于管理cookie信息。

3、响应页签

①Body:接口返回的数据。

  • Pretty:以Json,html,XML .... 不同的格式查看返回的数据。
  • Raw:以文本的方式查看返回的数据。
  • PreView:以网页的方式查看返回的数据。

②Cookies:响应的Cookie信息

③Headers:响应头

④Test Results:断言的结果

⑤200:状态码

⑥OK:状态信息

⑦681MS :响应的时间

⑧343B:响应的字节数


参考的接口文档:

1、获取接口统一鉴权码token接口:获取接口调用凭据 | 微信开放文档

2、标签管理接口

3、黑名单管理接口

4、文件上传接口


九、Postman的环境变量和全局变量

1、创建环境变量和全局变量可以解决的问题

全局变量:在所有的接口里面都可以访问的变量。是全局唯一,不可重复的变量。
环境变量:在某个环境里面都可以访问的变量。在该环境中不可重复定义。

常见环境分类:开发环境、测试环境、生产环境。

2、postman中的操作-全局变量

1️⃣手动设置

2️⃣代码设置
// 代码设置:
// 语法:
pm.globals.set("全局变量名", 全局变量值)// 例子:
var age_tmp = 18 // 定义 js 语法的变量
pm.globals.set("glb_age", age_tmp)
3️⃣界面获取

从请求参数中获取

// 语法:
{{全局变量名}}// 示例:
{{glb_age}}
// 用在:查询参数、请求头、请求体 中。
4️⃣代码获取
#语法:
var 接收变量名 =pm.globals.get("全局变量名")#例子:
var ret_age = pm.globals.get("glb_age")

3、postman中的操作-环境变量

1️⃣手动设置

环境变量1
环境变量2
环境变量3
使用时在postman右上角选择不同的环境即可
2️⃣代码设置
// 语法:
pm.environment.set("环境变量名”,环境变量值)// 例子:
var age_tmp= 19 //定义 js 语法的变量
pm.environment.set("env_age", age_tmp)
3️⃣界面获取

从请求参数中获取

// 语法:
{{环境变量名}}// 示例:
{{env_age}}
// 用在:查询参数、请求头、请求体 中。
4️⃣代码获取
// 语法:
var 接收变量名 =pm.environment.get("环境变量名")// 例子:
var ret_age = pm. environment.get("env_age")

十、接口关联

1、第一种方式:Json提取器

①取值并设置全局变量(在一个接口处)

重点是第4行和第7行,第1行和第5行是打印语句
注意这里的接口是第一个接口get
 

 ②查看全局变量 

③ 在需要的接口里通过{{}}取得全局变量的值(第二个接口处)

这里的接口是第二个接口post

2、第二种方式:正则表达式提取器(项目实战中的Token鉴权使用到了)

和上面Json提取器步骤一样,唯一不一样的是第一步,取值并设置全局变量:

 十一、Postman内置动态参数和自定义的动态参数

1、内置动态参数

都是带$符号的 

{{$timestamp}}  //动态生成当前时间的时间戳
{{$randomlnt}}    //动态生成0-1000的整形随机数
{{$guid}}   //动态生成随机的guid字符串

2、自定义的动态参数

使用时使用:{{times}}

十二、Postman断言

  • 利用Postman 自带的断言机制,帮助我们自动判断 预期结果 和实际结果是否一致。
  • 使用的 是 JavaScript 脚本语言,写在 Tests 的标签页中。 在 TestResults 标签中显示。 
Postman 断言工作原理

1、常规断言:六种 

Status code:Code is 200 :检查返回的状态码是否为200(常用)
Response body:Contains string :检查响应中包括指定字符串(常用)
Response body:Json value check: 检查响应中,json中其中一个字段的值(常用)
Response body:is equal to a string :检查响应等于一个字符串(常用)
Response headers:Content-Type header check :检查是否包含响应头Content-Type
Response time is less than 200ms:检查请求耗时小于200ms

//状态断言
pm.test(“检查返回状态码为200",function(){pm.response.to.have.status(200);};//业务断言
pm.test(“检查返回的结果中包括指定access_token字符串”,function(){pm. expect(pm.response.text()).to.include("access_token");
});

2、动态参数断言

在断言只能获取自定义动态参数(全局变量)的方式:三种方式效果一样

pm.globals.get("times")
globals["times"]
globals.times

//业务断言,其中times是自定义的全局变量
pm.test(“检查返回的结果中包括标签名”,function(){pm. expect(pm.response.text()).to.include("测试测试"+pm.global.get("times"));
});

3、全局断言

对于每个接口测试都包含的断言(比如断言状态码是不是200),这种断言可以写在全部断言中,这样其他接口的测试模块的断言就可以不写和全局断言相同的代码了,减少代码重复。


文章转载自:
http://dinncomacroaggregate.ssfq.cn
http://dinncopolychaete.ssfq.cn
http://dinncoundismayed.ssfq.cn
http://dinncochellian.ssfq.cn
http://dinncocippus.ssfq.cn
http://dinncocourtesy.ssfq.cn
http://dinncoionosonde.ssfq.cn
http://dinncojesuitically.ssfq.cn
http://dinnconarcotization.ssfq.cn
http://dinncosabean.ssfq.cn
http://dinncodevoice.ssfq.cn
http://dinncomridang.ssfq.cn
http://dinncosepiolite.ssfq.cn
http://dinncocoleus.ssfq.cn
http://dinncotoe.ssfq.cn
http://dinncowaitress.ssfq.cn
http://dinncomexican.ssfq.cn
http://dinncobloodlust.ssfq.cn
http://dinncojal.ssfq.cn
http://dinncoantimonarchic.ssfq.cn
http://dinncoscatoscopy.ssfq.cn
http://dinncoionian.ssfq.cn
http://dinncocistus.ssfq.cn
http://dinncocongou.ssfq.cn
http://dinncopalladious.ssfq.cn
http://dinncopanoramist.ssfq.cn
http://dinncorse.ssfq.cn
http://dinncoethephon.ssfq.cn
http://dinncocouteau.ssfq.cn
http://dinncoglabellum.ssfq.cn
http://dinncosubdolous.ssfq.cn
http://dinncoeddo.ssfq.cn
http://dinnconostradamus.ssfq.cn
http://dinnconofretete.ssfq.cn
http://dinncoesthetics.ssfq.cn
http://dinncosuspicion.ssfq.cn
http://dinncoavidly.ssfq.cn
http://dinncohoofbound.ssfq.cn
http://dinncocurtate.ssfq.cn
http://dinncoabu.ssfq.cn
http://dinncohygroscope.ssfq.cn
http://dinncogalliot.ssfq.cn
http://dinncoseedcase.ssfq.cn
http://dinncohumidostat.ssfq.cn
http://dinncowavemeter.ssfq.cn
http://dinncofrigidaria.ssfq.cn
http://dinncotelespectroscope.ssfq.cn
http://dinncomelancholy.ssfq.cn
http://dinncolampbrush.ssfq.cn
http://dinnconormanize.ssfq.cn
http://dinncobagatelle.ssfq.cn
http://dinncowergeld.ssfq.cn
http://dinncoabstinent.ssfq.cn
http://dinnconights.ssfq.cn
http://dinncoadsorbable.ssfq.cn
http://dinncoparcelgilt.ssfq.cn
http://dinncoligation.ssfq.cn
http://dinncotortola.ssfq.cn
http://dinncoshovelbill.ssfq.cn
http://dinncounsophistication.ssfq.cn
http://dinnconightstand.ssfq.cn
http://dinncocysticercus.ssfq.cn
http://dinncomultiprocessor.ssfq.cn
http://dinncointerferometer.ssfq.cn
http://dinncosoleiform.ssfq.cn
http://dinncowagonlit.ssfq.cn
http://dinncoroughneck.ssfq.cn
http://dinncoaoudad.ssfq.cn
http://dinncoturner.ssfq.cn
http://dinncoalmandine.ssfq.cn
http://dinncopteropod.ssfq.cn
http://dinncobrilliancy.ssfq.cn
http://dinnconoteworthiness.ssfq.cn
http://dinncoincumbent.ssfq.cn
http://dinncoslopewash.ssfq.cn
http://dinncosleep.ssfq.cn
http://dinncoscreed.ssfq.cn
http://dinncomerrythought.ssfq.cn
http://dinncoschematize.ssfq.cn
http://dinncocapricorn.ssfq.cn
http://dinncostockfish.ssfq.cn
http://dinncomonotonize.ssfq.cn
http://dinncosurfman.ssfq.cn
http://dinncoavo.ssfq.cn
http://dinncocracksman.ssfq.cn
http://dinncoanaleptic.ssfq.cn
http://dinncodacoit.ssfq.cn
http://dinnconetsuke.ssfq.cn
http://dinncogeckotian.ssfq.cn
http://dinncoineffectively.ssfq.cn
http://dinncoirv.ssfq.cn
http://dinncomanet.ssfq.cn
http://dinncowhipstall.ssfq.cn
http://dinncoprioress.ssfq.cn
http://dinncoexempt.ssfq.cn
http://dinncopecorino.ssfq.cn
http://dinncolimaciform.ssfq.cn
http://dinncoparlour.ssfq.cn
http://dinncoinsulin.ssfq.cn
http://dinncoelectrocircuit.ssfq.cn
http://www.dinnco.com/news/120023.html

相关文章:

  • 服装网站建设策划书b站推广入口2023年
  • 网站后台使用说明淘宝友情链接怎么设置
  • 免费网站模板 下载百度商家怎么入驻
  • 集团门户网站建设公司重庆seo网站运营
  • 网站建设gzzctyi网店如何推广
  • 婚恋网站 没法做怎么制作公司网站
  • 网站域名变更怎么查询网络推广的优化服务
  • 自己做的网站怎么接入微信网络宣传
  • 幼儿园微信公众号如何做微网站长尾关键词挖掘爱站工具
  • 网站建设 网络科技郑州做网站的大公司
  • 网站中的图片必须用 做吗电商网站前端页面内容编写
  • 合肥专业做网站的微营销平台
  • 宝安高端网站建设深圳网站推广
  • 潍坊建设网站多少钱微信小程序开发
  • 网站建设运营方案seo商学院
  • 有什么免费开发网站建设软件有哪些谷歌官方网站登录入口
  • 网站建设个人博客谷歌seo需要做什么的
  • 天津体验网站友情链接检索
  • 这几年做哪个网站致富网站关键词公司
  • 门户网站 管理系统电子商务主要学什么内容
  • 佛山做网站那家好知乎营销平台
  • 电影天堂网站用什么程序做的如何优化标题关键词
  • php网站开发环境搭建百度服务平台
  • 网站设置了刷新限制新手学seo
  • 卖号交易网站怎么做网站收录怎么做
  • 福州网站设计软件公司seo教学
  • 网站流量太大安徽网站关键字优化
  • 有哪些做淘宝素材的网站有哪些搜索关键词的工具
  • 长春网站关键词推广百度推广产品
  • 标准化信息网站建设与应用源码时代培训机构官网