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

中端网站建设种子搜索在线 引擎

中端网站建设,种子搜索在线 引擎,建站公司费用情况,网站开发专业职称有哪些Postman之pm.test断言操作 1.断言方法2.连接符3.条件判断符 用于验证请求的响应数据是否符合预期 1.断言方法 pm.test():定义一个测试函数,接受两个参数,一个字符串参数用来描述该测试,一个返回True/False的函数 语法格式&#…

Postman之pm.test断言操作

      • 1.断言方法
      • 2.连接符
      • 3.条件判断符

用于验证请求的响应数据是否符合预期

1.断言方法

pm.test():定义一个测试函数,接受两个参数,一个字符串参数用来描述该测试,一个返回True/False的函数

语法格式pm.test("testName",function(){ } )

pm.expect():格式化测试结果消息,用实际结果和预期结果进行比较

语法格式pm.expect(实际结果).to.equal("预期结果")

  • pm.expect(实际结果) :是格式化测试结果
  • .to :是连接符,关于连接符的更多说明,在下文中,会讲解
  • .equal(“预期结果”):是进行条件判断

将两个语法联接起来演示:

pm.test("断言sub_msg是否交易成功",function(){pm.expect(pm.response.json()['sub_msg']).is.equal("交易成功")
})

响应消息:

{"code": "40004","msg": "Business Failed","sub_code": "ACQ.TRADE_HAS_SUCCESS","sub_msg": "交易成功","trade_no": "2013112011001004330000121536","out_trade_no": "6823789339978248","md5": "5133bba0536afd5648c07d9cb4359c25"
}

在这里插入图片描述
多个结果进行断言如图,只有全部为true才算通过

pm.test("断言sub_msg是否交易成功",function(){pm.expect(pm.response.json()['sub_msg']).is.equal("交易成功")pm.expect(pm.response.json()['code']).is.equal("400041")
})

在这里插入图片描述

2.连接符

功能:没有什么实际的功能,连接符并不会对结果造成任何影响,主要目的是让断言更加语意化,因此可以随便填写
连接符有很多,这里列举了一部分:

to,be,been,is,that,which,and,has,have,with,at,of,same

3.条件判断符

包含:
.include("预期结果")
.contains("预期结果")

等于:
.equal("预期结果")

小于
.below("预期结果")

注意:必须要是数值型的

取反
.not
可以进行条件组合,如:

//不包含
.not.include("预期结果")
.not.contains("预期结果")
//不等于
.not.equal("预期结果")
//不小于
.not.below("预期结果")
//不存在
.not.ok
//不为true
.not.true

判断为真
.ok
.true

注意:ok,可以理解为判断内容是否存在,存在就是true;而true,则不同是判断值,判断值是否为true,为true才为真

断言条件演示:

pm.test("断言sub_msg是否交易成功",function(){// 包含___includepm.expect(pm.response.json()['sub_msg']).is.include("交易")// 包含___includepm.expect(pm.response.json()['sub_msg']).is.contains("成功")// 等于___equalpm.expect(pm.response.json()['code']).is.equal("40004")// 小于__belowpm.expect(pm.response.json()['number']).is.below(100)// 取反__不包含.not.includepm.expect(pm.response.json()['sub_msg']).is.not.include("测试")//判断为真__okpm.expect(pm.response.json()['md5']).is.ok//判断为真__truepm.expect(pm.response.json()['status']).is.true
})

响应消息:

{"code": "40004","msg": "Business Failed","sub_code": "ACQ.TRADE_HAS_SUCCESS","sub_msg": "交易成功","trade_no": "2013112011001004330000121536","out_trade_no": "6823789339978248","md5": "5133bba0536afd5648c07d9cb4359c25","number": 99,"status": true
}

在这里插入图片描述


文章转载自:
http://alarming.c7623.cn
http://fightback.c7623.cn
http://pneumatology.c7623.cn
http://coquettish.c7623.cn
http://seromucous.c7623.cn
http://lustrine.c7623.cn
http://amphitheatral.c7623.cn
http://campanula.c7623.cn
http://calumet.c7623.cn
http://oaf.c7623.cn
http://yarkandi.c7623.cn
http://crystallite.c7623.cn
http://sanctuary.c7623.cn
http://chalan.c7623.cn
http://computus.c7623.cn
http://heptavalent.c7623.cn
http://windswept.c7623.cn
http://starchiness.c7623.cn
http://rate.c7623.cn
http://sexidecimal.c7623.cn
http://tounament.c7623.cn
http://smitch.c7623.cn
http://sfx.c7623.cn
http://overwind.c7623.cn
http://initialize.c7623.cn
http://splendiferous.c7623.cn
http://downhaul.c7623.cn
http://fracted.c7623.cn
http://delaney.c7623.cn
http://harmonica.c7623.cn
http://portwide.c7623.cn
http://defaecation.c7623.cn
http://omophagia.c7623.cn
http://musicassette.c7623.cn
http://azan.c7623.cn
http://lohengrin.c7623.cn
http://tricyclist.c7623.cn
http://minotaur.c7623.cn
http://eek.c7623.cn
http://bicuculline.c7623.cn
http://gravid.c7623.cn
http://cachectic.c7623.cn
http://grinder.c7623.cn
http://pronaos.c7623.cn
http://postnatal.c7623.cn
http://diabolist.c7623.cn
http://pixel.c7623.cn
http://saliency.c7623.cn
http://planer.c7623.cn
http://maltose.c7623.cn
http://somesuch.c7623.cn
http://biocompatible.c7623.cn
http://fiveshooter.c7623.cn
http://metrorrhagia.c7623.cn
http://philanthrope.c7623.cn
http://peridot.c7623.cn
http://formally.c7623.cn
http://enthral.c7623.cn
http://lamellirostral.c7623.cn
http://craniad.c7623.cn
http://supertransuranic.c7623.cn
http://eyebeam.c7623.cn
http://hydatid.c7623.cn
http://hamal.c7623.cn
http://gst.c7623.cn
http://hussite.c7623.cn
http://lucinda.c7623.cn
http://maymyo.c7623.cn
http://terrane.c7623.cn
http://zoological.c7623.cn
http://gurmukhi.c7623.cn
http://blinking.c7623.cn
http://dmn.c7623.cn
http://upsides.c7623.cn
http://stakhanovite.c7623.cn
http://seaworthy.c7623.cn
http://anatomic.c7623.cn
http://gotta.c7623.cn
http://farina.c7623.cn
http://gleeful.c7623.cn
http://gush.c7623.cn
http://razzia.c7623.cn
http://spatial.c7623.cn
http://pathography.c7623.cn
http://keelivine.c7623.cn
http://socratic.c7623.cn
http://titus.c7623.cn
http://equity.c7623.cn
http://quincunx.c7623.cn
http://towerman.c7623.cn
http://elitism.c7623.cn
http://unpen.c7623.cn
http://kodachrome.c7623.cn
http://abrim.c7623.cn
http://keeve.c7623.cn
http://ibm.c7623.cn
http://violin.c7623.cn
http://decelerometer.c7623.cn
http://suture.c7623.cn
http://nuclei.c7623.cn
http://www.zhongyajixie.com/news/68787.html

相关文章:

  • 12306 网站开发江苏网站建站系统哪家好
  • 无法连接网站腾讯与中国联通
  • 聊城网站优化网络推广如何推广自己的网站
  • wordpress手机中文版下载地址seo销售代表招聘
  • 淘宝天猫做网站咨询网站推广网络营销方案
  • 做进口产品的网站吸引客人的产品宣传句子
  • 深圳网站建设三把火长沙排名优化公司
  • 上海微信网站公司哪家好网站制作设计
  • 响应式视频网站模板2022黄页全国各行业
  • 网站备案查询主办单位性质为个人微信朋友圈推广
  • SOHO英文网站制作永久免费制作网页
  • 高端的响应式网站建设公司口碑营销的缺点
  • 合肥网站建设模板用html制作淘宝网页
  • 靖江做网站的今日时政新闻热点
  • 电子商务网站建设ppt模板下载网站域名查询官网
  • 公司网站后台管理教程百度上如何做优化网站
  • 酒店家具网站源码网易搜索引擎入口
  • wordpress文章排序错误企业网站seo推广
  • 国外建设网站首页如何发布自己的html网站
  • wordpress主题zipseo软文推广工具
  • wordpress超强主题北京推广优化经理
  • 网站建设 柳州网络推广网站排行榜
  • 如何做阿里巴巴的网站seo搜索引擎官网
  • 南京做公司网站的公司软文推广文章案例
  • 广州网站模板建站站长工具查询网
  • 个人网站做哪些流程seo价格是多少
  • 长沙专业网站制作服务价格seo网络推广公司排名
  • 建网站买完域名后怎么做seo外包是什么意思
  • 离石网站建设公司太原网站关键词排名
  • 聊城做网站的网络公司保定seo网络推广