[英]In Postman, how do I take a response body from a Get Request, and put it in a PUT request with minor changes
[英]How do I get my Postman tests to pass using response body as the results?
我第一次尝试在 Postman 中编写测试。 我正在使用包含pm.expect
的pm.test
方法。
这是我的测试:
//contract details tests
pm.test("Contract data is correct", function() {
pm.expect(pm.response.json().results.contractNb).to.equal("00002");
pm.expect(pm.response.json().results.progSrvcNm).to.equal("009");
});
我的回答是这样的:
{
"contractNb": "00002",
"progSrvcNm": "009",
"contractPartyNm": "testContract",
"terms": 30,
"startDt": "2018-01-01"
}
正确的代码是 Danny Dainton 发布的。
pm.test('Contract details are correct for the passed in contract ID', () => {
pm.expect(pm.response.json().contractNb).to.equal("00002");
pm.expect(pm.response.json().progSrvcNm).to.equal("009");
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.