fix(接口自动化): 修复IF条件为空时无法保存问题
This commit is contained in:
parent
9dee308d8e
commit
986d24724a
|
@ -85,7 +85,6 @@ public class HarScenarioParser extends HarScenarioAbstractParser<ScenarioImport>
|
|||
if (request != null) {
|
||||
results.add(request);
|
||||
}
|
||||
request.setRequestResult(getRequestResult(request,item));
|
||||
}
|
||||
scenario.setHashTree(results);
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ public class MsIfController extends MsTestElement {
|
|||
}
|
||||
|
||||
public String getContentValue() {
|
||||
try {
|
||||
String content = this.variable;
|
||||
Pattern regex = Pattern.compile("\\$\\{([^}]*)\\}");
|
||||
Matcher matcher = regex.matcher(content);
|
||||
|
@ -91,11 +92,14 @@ public class MsIfController extends MsTestElement {
|
|||
return this.variable;
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getCondition() {
|
||||
String key = getContentValue();
|
||||
String variable = key.equals(this.variable) ? "\"" + this.variable + "\"" : "vars.get('" + key + "')";
|
||||
String variable = (StringUtils.isEmpty(key) || key.equals(this.variable)) ? "\"" + this.variable + "\"" : "vars.get('" + key + "')";
|
||||
String operator = this.operator;
|
||||
String value;
|
||||
if (StringUtils.equals(operator, "<") || StringUtils.equals(operator, ">")) {
|
||||
|
|
|
@ -109,9 +109,6 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
@JSONField(ordinal = 34)
|
||||
private List<KeyValue> arguments;
|
||||
|
||||
@JSONField(ordinal = 35)
|
||||
private Object requestResult;
|
||||
|
||||
@JSONField(ordinal = 36)
|
||||
private MsAuthManager authManager;
|
||||
|
||||
|
|
Loading…
Reference in New Issue