fix(接口测试): 变量断言期望值中带有特殊符号,断言失败
--bug=1037889 --user=陈建星 【项目环境】环境管理-断言中添加变量断言-断言匹配包含json格式时,断言错误 https://www.tapd.cn/55049933/s/1497938
This commit is contained in:
parent
3748463caf
commit
ccb11753f3
|
@ -8,6 +8,7 @@ import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||||
import io.metersphere.sdk.constants.MsAssertionCondition;
|
import io.metersphere.sdk.constants.MsAssertionCondition;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.text.StringEscapeUtils;
|
||||||
import org.apache.jmeter.assertions.JSR223Assertion;
|
import org.apache.jmeter.assertions.JSR223Assertion;
|
||||||
import org.apache.jorphan.collections.HashTree;
|
import org.apache.jorphan.collections.HashTree;
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ public class VariableAssertionConverter extends AssertionConverter<MsVariableAss
|
||||||
variableValue = vars.get("%s");
|
variableValue = vars.get("%s");
|
||||||
expectation = "%s";
|
expectation = "%s";
|
||||||
flag = true;
|
flag = true;
|
||||||
""", variableAssertionItem.getVariableName(), variableAssertionItem.getExpectedValue());
|
""", StringEscapeUtils.escapeJava(variableAssertionItem.getVariableName()), StringEscapeUtils.escapeJava(variableAssertionItem.getExpectedValue())); // 转义一下再填充
|
||||||
|
|
||||||
handleMap.put(MsAssertionCondition.REGEX.name(),
|
handleMap.put(MsAssertionCondition.REGEX.name(),
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue