postman-检查点

 时间:2026-02-12 14:22:15

1、postman发送get请求

01输入url(统一资源定位器(Uniform Resource Locator)

02点击send

入下图所示:

postman-检查点

2、这里我们设置检查点的信息包含:“网易公益_有态度的公益门户”

同时响应信息包含httpCode为200,响应成功。

01点击url下方的test

如图所示:

postman-检查点

3、可以直接手动输入JS函数,也可以在右侧方框里选择tests,

在learn more about tests 可以查看学习更多的函数。

如图所示:

postman-检查点

1、找到Response body:Contains string

点击。

tests中便出现函数:

pm.test("Body matches string", function () {

    pm.expect(pm.response.text()).to.include("string_you_want_to_search");

});

将"string_you_want_to_search" 替换为 我们需要的检查内容:“网易公益_有态度的公益门户”

如下图所示:

postman-检查点

postman-检查点

2、同样我们找到Status code:code is 200,

点击。生成函数如下:

pm.test("Status code is 200", function () {

    pm.response.to.have.status(200);

});

postman-检查点

3、点击save,然后点击send,发送请求。

然后查看 test results

如下图所示:

因此,我们针对我们的API设置了2个测试检查点,

01)status code等于200

02)response body中包含字符串:网易公益_有态度的公益门户

版权声明:本文为博主原创文章,转载请注明出处,谢谢

postman-检查点

  • 辣椒烘干机压缩机超温报警故障处理流程
  • 自驾游西安旅游攻略
  • 去农村拍摄乡村风格的写真应该注意什么?
  • 国美门店积分线上使用直接抵现,无红券面额束缚
  • 鸡蛋羹的家常做法
  • 热门搜索
    huracan怎么读 收到法院传票怎么办 怎么增高 眼屎多是怎么回事 三角肌怎么练 小孩咳嗽怎么办 12306账号怎么注销 干无花果怎么吃 羊毛大衣怎么洗 怎么养精