【问题标题】:POSTMAN- Test ValidationPOSTMAN-测试验证
【发布时间】:2020-10-23 08:53:10
【问题描述】:

如果 "relatedDecisionTreeQuestionUID": "c68252d0-3f88-e911-a98e-12345600cf35" 然后将 "questionText" 显示为 Blocked 和 UnBlocked,我想为以下响应编写邮递员测试。

请有人帮忙处理一下 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": [

【问题讨论】:

  • 我有 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); } })

标签: testing postman


【解决方案1】:

试试这个,

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);
    }
});

});

【讨论】:

  • 我得到了这个错误,测试 | TypeError: jsonData.filter 不是函数
猜你喜欢
  • 1970-01-01
  • 2021-06-19
  • 2017-05-06
  • 2020-12-16
  • 2020-06-06
  • 2023-03-07
  • 1970-01-01
  • 2017-04-14
  • 2012-06-29
相关资源
最近更新 更多