refactor(接口测试): 变量断言正则匹配,优化变量不存在报错提示
--bug=1039695 --user=陈建星 【接口测试】定义-断言-值为josn和list断言失败 https://www.tapd.cn/55049933/s/1503406
This commit is contained in:
parent
f3330726ec
commit
c1a2eeb752
|
@ -81,7 +81,11 @@ public class VariableAssertionConverter extends AssertionConverter<MsVariableAss
|
||||||
handleMap.put(MsAssertionCondition.REGEX.name(),
|
handleMap.put(MsAssertionCondition.REGEX.name(),
|
||||||
"""
|
"""
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
if (variableValue != null) {
|
||||||
result = Pattern.matches(Pattern.quote(expectation), variableValue);
|
result = Pattern.matches(Pattern.quote(expectation), variableValue);
|
||||||
|
} else {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
msg = variableValue + " not matching " + expectation;
|
msg = variableValue + " not matching " + expectation;
|
||||||
""");
|
""");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue