postman断言
常见一些断言方法
Status code is 200 (状态码为200)
pm.test("Status code is 200", function () { pm.response.to.have.status(200); });
Code name contains a string (代码名称包含一个字符串)
pm.test("Body matches string", function () { pm.expect(pm.response.text()).to.include ("resultcode\":\"200"); });
Set a global varable (设置一个全局变量)
pm.globals.set("access", token);
Response body:JSON value check (检查JOSN的值)
pm.test("Your test name", function () { var jsonData = pm.response.json(); pm.expect(jsonData.value).to.eql(100); });
相关推荐
充满诗意的联盟 2020-08-23
huimeiad 2020-11-23
82387067 2020-11-03
bbccaaa 2020-11-03
ljsfighting 2020-10-31
小马的学习笔记 2020-10-23
chenhaimeimeng 2020-09-15
82387067 2020-08-15
bbccaaa 2020-07-28
ljsfighting 2020-07-28
ljsfighting 2020-07-18
ljsfighting 2020-07-05
Alassad 2020-06-29
pushTop 2020-06-27
curiousL 2020-06-21
Teamomc 2020-06-12
ljsfighting 2020-06-05