fix(用例管理): 场景列表变量按逗号分隔,支持逗号转义
--bug=1045007 --user=陈建星 github #32177 支持用户在","前加"\"以区分分隔符 https://www.tapd.cn/55049933/s/1580890
This commit is contained in:
parent
8e86034849
commit
e3417dd9d9
|
@ -49,7 +49,8 @@ public class JmeterTestElementParserHelper {
|
||||||
public static UserParameters getUserParameters(List<CommonVariables> constantVariables, List<CommonVariables> listVariables) {
|
public static UserParameters getUserParameters(List<CommonVariables> constantVariables, List<CommonVariables> listVariables) {
|
||||||
List<CommonVariables> variableResults = new ArrayList<>();
|
List<CommonVariables> variableResults = new ArrayList<>();
|
||||||
listVariables.forEach(listVariable -> {
|
listVariables.forEach(listVariable -> {
|
||||||
String[] arrays = listVariable.getValue().replaceAll("[\r\n]", "").split(",");
|
// 按 ',' 分割,但是支持 \, 转义
|
||||||
|
String[] arrays = listVariable.getValue().replaceAll("[\r\n]", "").split("(?<!\\\\),");
|
||||||
for (int i = 0; i < arrays.length; i++) {
|
for (int i = 0; i < arrays.length; i++) {
|
||||||
CommonVariables commonVariables = BeanUtils.copyBean(new CommonVariables(), listVariable);
|
CommonVariables commonVariables = BeanUtils.copyBean(new CommonVariables(), listVariable);
|
||||||
commonVariables.setKey(listVariable.getKey() + "_" + (i + 1));
|
commonVariables.setKey(listVariable.getKey() + "_" + (i + 1));
|
||||||
|
|
Loading…
Reference in New Issue