fix(接口测试): 修复jsonPath提取问题

This commit is contained in:
wxg0103 2024-04-08 17:08:29 +08:00 committed by 刘瑞斌
parent 8e2a08a18b
commit 50e6ecadae
1 changed files with 4 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package io.metersphere.api.parser.jmeter.processor.extract;
import io.metersphere.project.api.processor.extract.JSONPathExtract;
import io.metersphere.plugin.api.dto.ParameterConfig;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.extractor.json.jsonpath.JSONPostProcessor;
import org.apache.jmeter.save.SaveService;
import org.apache.jmeter.testelement.TestElement;
@ -23,9 +24,11 @@ public class JSONPathExtractConverter extends ExtractConverter<JSONPathExtract>
extractor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(JSON_POST_PROCESSOR_GUI));
extractor.setRefNames(msExtract.getVariableName());
extractor.setJsonPathExpressions(msExtract.getExpression());
extractor.setProperty("JSONPostProcessor.compute_concat", true);
// 处理匹配多条等匹配规则
extractor.setMatchNumbers(parseResultMatchingRule(msExtract).toString());
if (StringUtils.equals(extractor.getMatchNumbers(), "-1")) {
extractor.setComputeConcatenation(true);
}
extractor.setEnabled(msExtract.getEnable());
hashTree.add(extractor);
}