运行收集运行器时,我想记录通过cvs文件发送的参数。这可能吗?我想检索所有失败的参数的列表(正在测试6000多个项目)。
当我导出测试结果时,我看不到失败的参数项。我想要的。
我尝试记录以下响应:
console.log(DRAWING_NO)
DRAWING_NO是在环境中设置的全局变量
测试代码
enter var jsonData = JSON.parse(responseBody);
if (jsonData.Drawings === null) {
pm.test("sample-test-fail", function () {
throw new Error();
});
let drawingno = pm.iterationData.get("DRAWING_NO");
console.log(drawingno);
} else if (jsonData.Drawings !== null) {
//postman.setEnvironmentVariable("UFID", jsonData.Drawings.Drawing.UFID);
//console.log(jsonData.Drawings.Drawing.length);
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
jsonData.Drawings.Drawing.forEach(function (data) {
postman.setEnvironmentVariable("UFID", data.UFID);
postman.setEnvironmentVariable("INST_TYPE", data.INST_TYPE);
postman.setEnvironmentVariable("HYD_TYPE", data.HYD_TYPE);
pm.test("Check Drawing NO for " + data.DRAWING_NO, function(){
pm.expect(data.DRAWING_NO).not.eql(null);
});
pm.test("Check Sales ID for " + data.DRAWING_NO, function(){
pm.expect(data.SALES_ID).not.eql(null);
});
pm.test("Check HYD_TYPE for " + data.DRAWING_NO, function(){
pm.expect(data.HYD_TYPE).not.eql(null);
});
pm.test("Check INST_TYPE NO for " + data.DRAWING_NO, function(){
pm.expect(data.INST_TYPE).not.eql(null);
});
pm.test("Check Sales Code for " + data.DRAWING_NO, function(){
pm.expect(data.SALES_CODE).not.eql(null);
});
pm.test("Check LIFECYCLE_STATE for " + data.DRAWING_NO, function(){
pm.expect(data.LIFECYCLE_STATE).eql("RELEASED");
});
//pm.test("Check VERSION CODE Code for " + data.DRAWING_NO, function () {
// pm.expect(data.VERSION_CODE).not.eql(null);
//});
//pm.test("Check DRIVE UNIT for " + data.DRAWING_NO, function () {
// pm.expect(data.DRIVE_UNIT).not.eql(null);
//});
//pm.test("Check Outlet US for " + data.DRAWING_NO, function () {
// pm.expect(data.OUTLET_US).not.eql(null);
//});
});
}
这里