mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 20:19:16 +08:00
fix(用例管理): 场景列表变量按逗号分隔,支持逗号转义
--bug=1045007 --user=陈建星 github #32177 支持用户在","前加"\"以区分分隔符 https://www.tapd.cn/55049933/s/1581223
This commit is contained in:
parent
6447cf04b7
commit
acf5603057
@ -49,12 +49,12 @@ public class JmeterTestElementParserHelper {
|
||||
public static UserParameters getUserParameters(List<CommonVariables> constantVariables, List<CommonVariables> listVariables) {
|
||||
List<CommonVariables> variableResults = new ArrayList<>();
|
||||
listVariables.forEach(listVariable -> {
|
||||
// 按 ',' 分割,但是支持 \, 转义
|
||||
// 按 ',' 分割,但是支持 '\,' 转义
|
||||
String[] arrays = listVariable.getValue().replaceAll("[\r\n]", "").split("(?<!\\\\),");
|
||||
for (int i = 0; i < arrays.length; i++) {
|
||||
CommonVariables commonVariables = BeanUtils.copyBean(new CommonVariables(), listVariable);
|
||||
commonVariables.setKey(listVariable.getKey() + "_" + (i + 1));
|
||||
commonVariables.setValue(arrays[i]);
|
||||
commonVariables.setValue(arrays[i].replace("\\,", ","));
|
||||
variableResults.add(commonVariables);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user