fix(接口测试): 正则断言失效
--bug=1039800 --user=陈建星 【接口测试】断言-变量,正则匹配断言错误 https://www.tapd.cn/55049933/s/1503523
This commit is contained in:
parent
c1a2eeb752
commit
2aef4d50b9
|
@ -55,7 +55,7 @@ public class KeyValueInfo {
|
|||
}
|
||||
} else if (StringUtils.equals(this.condition, ParamConditionEnums.REGULAR_MATCH.name())) {
|
||||
try {
|
||||
return this.value.matches(Pattern.quote(value));
|
||||
return this.value.matches(value);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ public class ResponseHeaderAssertionConverter extends AssertionConverter<MsRespo
|
|||
String testString = expectedValue;
|
||||
if (StringUtils.isNotEmpty(regexTemplate)) {
|
||||
testString = regexTemplate
|
||||
.replace("%key", Pattern.quote(header))
|
||||
.replace("%value", Pattern.quote(expectedValue));
|
||||
.replace("%key", header)
|
||||
.replace("%value", expectedValue);
|
||||
}
|
||||
|
||||
if (StringUtils.startsWith(msAssertionCondition.name(), "NOT")) {
|
||||
|
|
|
@ -82,7 +82,7 @@ public class VariableAssertionConverter extends AssertionConverter<MsVariableAss
|
|||
"""
|
||||
import java.util.regex.Pattern;
|
||||
if (variableValue != null) {
|
||||
result = Pattern.matches(Pattern.quote(expectation), variableValue);
|
||||
result = Pattern.matches(expectation, variableValue);
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue