fix(接口自动化): 设置共享模式解决 循环 csv 从第二行取值问题
This commit is contained in:
parent
ae624768b3
commit
6567dd2ec7
|
@ -156,7 +156,7 @@ public class MsScenario extends MsTestElement {
|
|||
if (arguments != null) {
|
||||
tree.add(ParameterConfig.valueSupposeMock(arguments));
|
||||
}
|
||||
this.addCsvDataSet(tree, variables,config);
|
||||
this.addCsvDataSet(tree, variables, config, "shareMode.group");
|
||||
this.addCounter(tree, variables);
|
||||
this.addRandom(tree, variables);
|
||||
if (CollectionUtils.isNotEmpty(this.headers)) {
|
||||
|
|
|
@ -188,7 +188,7 @@ public abstract class MsTestElement {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected void addCsvDataSet(HashTree tree, List<ScenarioVariable> variables, ParameterConfig config) {
|
||||
protected void addCsvDataSet(HashTree tree, List<ScenarioVariable> variables, ParameterConfig config, String shareMode) {
|
||||
if (CollectionUtils.isNotEmpty(variables)) {
|
||||
List<ScenarioVariable> list = variables.stream().filter(ScenarioVariable::isCSVValid).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
|
@ -206,8 +206,7 @@ public abstract class MsTestElement {
|
|||
csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName());
|
||||
}
|
||||
csvDataSet.setIgnoreFirstLine(false);
|
||||
// csvDataSet.setProperty("quotedData",true);
|
||||
csvDataSet.setProperty("shareMode", "shareMode.group");
|
||||
csvDataSet.setProperty("shareMode", shareMode);
|
||||
csvDataSet.setProperty("recycle", true);
|
||||
csvDataSet.setProperty("delimiter", item.getDelimiter());
|
||||
csvDataSet.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
|
||||
|
|
|
@ -56,7 +56,7 @@ public class MsLoopController extends MsTestElement {
|
|||
}
|
||||
final HashTree groupTree = controller(tree);
|
||||
if (CollectionUtils.isNotEmpty(config.getVariables())) {
|
||||
this.addCsvDataSet(groupTree, config.getVariables(), config);
|
||||
this.addCsvDataSet(groupTree, config.getVariables(), config, "shareMode.thread");
|
||||
this.addCounter(groupTree, config.getVariables());
|
||||
this.addRandom(groupTree, config.getVariables());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue