当前位置 : 主页 > 网页制作 > HTTP/TCP >

Postman使用教程

来源:互联网 收集:自由互联 发布时间:2021-06-16
安装 下载地址:https://www.getpostman.com/downloads/ 新建用例集 新建请求 发送请求 添加断言 在请求中 test 选项下,添加断言,在响应中的 Test result 查看断言结果 常用断言方法 pm.test("Statu

安装

  • 下载地址:https://www.getpostman.com/downloads/

新建用例集

新建请求

发送请求

添加断言

在请求中test选项下,添加断言,在响应中的Test result查看断言结果

常用断言方法

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
}); //断言状态码是200

pm.test("Body matches string “yunda”", function () {
    pm.expect(pm.response.text()).to.include("yunda");
}); //检查响应主体中是否包含指定字符串

断言案例

网友评论