fix(接口自动化) 修复变量提取问题

--bug=1004055 --user=赵勇 【github#3415】xml格式的response,脚本断言无法通过,javax.script.ScriptException异常 https://www.tapd.cn/55049933/s/1051066
This commit is contained in:
fit2-zhao 2021-09-24 10:36:09 +08:00 committed by fit2-zhao
parent f6a3b4d8dc
commit ec091bd43c
1 changed files with 7 additions and 2 deletions

View File

@ -43,6 +43,7 @@ public class JMeterVars {
for (String item : extracts) {
String nrKey = item + "_matchNr";
Object nr = vars.get(nrKey);
JMeterVariables jMeterVariables = new JMeterVariables();
if (nr != null) {
int nrv = 0;
try {
@ -55,10 +56,14 @@ public class JMeterVars {
data.add(vars.get(item + "_" + i));
}
String array = JSON.toJSONString(data);
vars.put(item, array);
jMeterVariables.put(item, array);
}
}
vs.put(item, vars.get(item) == null ? "" : vars.get(item));
if (jMeterVariables.get(item) != null) {
vs.put(item, jMeterVariables.get(item));
} else {
vs.put(item, vars.get(item) == null ? "" : vars.get(item));
}
}
vs.remove("TESTSTART.MS"); // 标示变量移除
}