首页 > 解决方案 > 具有多个条件的 Jmeter Json Extractor - 失败

问题描述

我正在尝试创建一个 Json Extractor,它是一种思想活动。我有这个json结构:

[  
 {  
  "reportType":{  
     "id":3,
     "nomeTipoRelatorio":"etc etc etc",
     "descricaoTipoRelatorio":"etc etc etc",
     "esExibeSite":"S",
     "esExibeEmail":"S",
     "esExibeFisico":"N"
  },
  "account":{  
     "id":9999999,
     "holdersName":"etc etc etc",
     "accountNamber":"9999999",
     "nickname":null
  },
  "file":{  
     "id":2913847,
     "typeId":null,
     "version":null,
     "name":null,
     "format":null,
     "description":"description",
     "typeCode":null,
     "size":153196,
     "mimeType":null,
     "file":null,
     "publicationDate":"2018-12-05",
     "referenceStartDate":"2018-12-05",
     "referenceEndDate":"2018-12-06",
     "extension":null,
     "fileStatusLog":{  
        "idArquivo":2913847,
        "dhAlteracao":"2018-12-05",
        "nmSistema":"SISTEMA X",
        "idUsuario":999999,
        "reportStatusIndicador":"Z"
     }
  }
 }
]

我需要做的:首先,我使用“Compute concatenation var”和“Match No.”选项。作为-1。因为服务可以带来许多响应。

我必须验证,如果“reportStatusIndicador” = 'Z' 或 'Y',如果是肯定的,我必须收集 File.Id 或 file.FileStatusLog.idArquivo,它们是相同的,我正在尝试第一个选项,在这种情况下数字“2913847”,但如果有更多结果,我会收集所有 File.id`s

有了这些值,我将继续为所有 File.id 设置一个 for each。

我的最后一次尝试是这个组合,在阅读了很多并尝试了许多其他组合之后。

[?(@...file.fileStatusLog.reportStatusIndicador == 'Z' || @...file.fileStatusLog.reportStatusIndicador == 'Y')].file.id

但是我的调试后处理器总是这样显示,为空:filesIds=

标签: jsonjmeterstress-testingjson-extract

解决方案


去做$..[?(@.file.fileStatusLog.reportStatusIndicador == 'Z' || @.file.fileStatusLog.reportStatusIndicador == 'Y')].file.id

演示:

在此处输入图像描述

参考:


推荐阅读