fix(接口自动化): 修复CSV变量问题修复

This commit is contained in:
fit2-zhao 2021-02-01 19:13:16 +08:00
parent b136576c40
commit ed24d9c0ca
2 changed files with 4 additions and 6 deletions

View File

@ -188,15 +188,14 @@ public abstract class MsTestElement {
csvDataSet.setEnabled(true); csvDataSet.setEnabled(true);
csvDataSet.setProperty(TestElement.TEST_CLASS, CSVDataSet.class.getName()); csvDataSet.setProperty(TestElement.TEST_CLASS, CSVDataSet.class.getName());
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
csvDataSet.setName(item.getName()); csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName());
csvDataSet.setProperty("fileEncoding", item.getEncoding()); csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? "UTF-8" : item.getEncoding());
csvDataSet.setProperty("variableNames", item.getName());
if (CollectionUtils.isNotEmpty(item.getFiles())) { if (CollectionUtils.isNotEmpty(item.getFiles())) {
csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()); csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName());
} }
csvDataSet.setIgnoreFirstLine(false); csvDataSet.setIgnoreFirstLine(false);
csvDataSet.setProperty("delimiter", item.getDelimiter()); csvDataSet.setProperty("delimiter", item.getDelimiter());
csvDataSet.setComment(item.getDescription()); csvDataSet.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
tree.add(csvDataSet); tree.add(csvDataSet);
}); });
} }
@ -218,7 +217,7 @@ public abstract class MsTestElement {
counterConfig.setVarName(item.getName()); counterConfig.setVarName(item.getName());
counterConfig.setIncrement(item.getIncrement()); counterConfig.setIncrement(item.getIncrement());
counterConfig.setFormat(item.getValue()); counterConfig.setFormat(item.getValue());
counterConfig.setComment(item.getDescription()); counterConfig.setComment(StringUtils.isEmpty(item.getDescription()) ? "" : item.getDescription());
tree.add(counterConfig); tree.add(counterConfig);
}); });
} }

View File

@ -507,7 +507,6 @@ public class ApiAutomationService {
ParameterConfig config = new ParameterConfig(); ParameterConfig config = new ParameterConfig();
config.setConfig(envConfig); config.setConfig(envConfig);
HashTree hashTree = request.getTestElement().generateHashTree(config); HashTree hashTree = request.getTestElement().generateHashTree(config);
// 调用执行方法 // 调用执行方法
createScenarioReport(request.getId(), request.getScenarioId(), request.getScenarioName(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId(), createScenarioReport(request.getId(), request.getScenarioId(), request.getScenarioName(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId(),
SessionUtils.getUserId()); SessionUtils.getUserId());