2-10断言

 

 

 

 

 

 

 

 

//定义一个变量
pm.variables.set("user","51zxw");

 

 

 

 

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

username=pm.variables.get("user");
console.log("username:",username);

pm.test("check username", function () {
    var jsonData=pm.response.json();
    console.log("user:",jsonData.json['user']);
    pm.expect(jsonData.json['user']).to.eql(username);
});

pm.test("Response time is less than 500ms", function () {
    pm.expect(pm.response.responseTime).to.be.below(500);
});

 

posted @ 2021-04-02 08:00  牛小胖666  阅读(30)  评论(0编辑  收藏  举报