邮递员-测试验证

时间:2020-07-02 17:14:51

标签: testing postman

如果“ relatedDecisionTreeQuestionUID”:“ c68252d0-3f88-e911-a98e-12345600cf35”然后显示“ questionText”为“已阻止”和“未阻止”,我想为以下响应编写一个邮递员测试。

请有人可以帮助您使用javascript

”:

[
            {
                "estimationDuration": "0",
                "jobTypeUId": "00000000-0000-0000-0000-000000000000",
                "jobType": null,
                "relatedDecisionTreeQuestionUID": "c68252d0-3f88-e911-a98e-12345600cf35",
                "priorityUID": "00000000-0000-0000-0000-000000000000",
                "priority": "",
                "decisionTreeUID": "d73657e8-3f88-e911-a98e-11334800cf12",
                "workOrderTypeUID": "00000000-0000-0000-0000-000000000000",
                "workOrderType": "",    
                "questionText": "Blocked”,
                "childQuestions": [
": [
            {
                "estimationDuration": "0",
                "jobTypeUId": "00000000-0000-0000-0000-000000000000",
                "jobType": null,
                "relatedDecisionTreeQuestionUID": " c68252d0-3f88-e911-a98e-12345600cf35",
                "priorityUID": "00000000-0000-0000-0000-000000000000",
                "priority": "",
                "decisionTreeUID": "d73657e8-3f88-e911-a98e-00224800cf35",
                "workOrderTypeUID": "00000000-0000-0000-0000-000000000000",
                "workOrderType": "",    
                "questionText": " UnBlocked ",
                "childQuestions": [

1 个答案:

答案 0 :(得分:0)

尝试一下,

pm.test("test", function() {
  var jsonData = pm.response.json();
  jsonData.filter(function(item) {
     if (item.relatedDecisionTreeQuestionUID === " c68252d0-3f88-e911-a98e-12345600cf35") {
        console.log(item.questionText);
    }
});

});