fix(接口测试): 执行没有返回结果时提取变量保护处理
This commit is contained in:
parent
7972c91170
commit
5c83c7136e
|
@ -13,7 +13,8 @@ import java.util.*;
|
||||||
|
|
||||||
public class JMeterVars {
|
public class JMeterVars {
|
||||||
|
|
||||||
private JMeterVars() { }
|
private JMeterVars() {
|
||||||
|
}
|
||||||
|
|
||||||
// 数据和线程变量保持一致
|
// 数据和线程变量保持一致
|
||||||
private static Map<Integer, JMeterVariables> variables = new HashMap<>();
|
private static Map<Integer, JMeterVariables> variables = new HashMap<>();
|
||||||
|
@ -24,7 +25,7 @@ public class JMeterVars {
|
||||||
if (!StringUtils.isEmpty(extract) && vars != null) {
|
if (!StringUtils.isEmpty(extract) && vars != null) {
|
||||||
List<String> extracts = Arrays.asList(extract.split(";"));
|
List<String> extracts = Arrays.asList(extract.split(";"));
|
||||||
Optional.ofNullable(extracts).orElse(new ArrayList<>()).forEach(item -> {
|
Optional.ofNullable(extracts).orElse(new ArrayList<>()).forEach(item -> {
|
||||||
vs.put(item, vars.get(item));
|
vs.put(item, vars.get(item) == null ? "" : vars.get(item));
|
||||||
});
|
});
|
||||||
vs.remove("TESTSTART.MS"); // 标示变量移除
|
vs.remove("TESTSTART.MS"); // 标示变量移除
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue