diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java index b4325f33ff..58b712a08e 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java @@ -140,7 +140,7 @@ public class MsScenario extends MsTestElement { if (arguments != null) { tree.add(config.valueSupposeMock(arguments)); } - this.addCsvDataSet(tree, variables); + this.addCsvDataSet(tree, variables,config); this.addCounter(tree, variables); this.addRandom(tree, variables); if (CollectionUtils.isNotEmpty(this.headers)) { diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java index 55fdb3b511..1c80bbe352 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java @@ -201,7 +201,7 @@ public abstract class MsTestElement { return null; } - protected void addCsvDataSet(HashTree tree, List variables) { + protected void addCsvDataSet(HashTree tree, List variables,ParameterConfig config) { if (CollectionUtils.isNotEmpty(variables)) { List list = variables.stream().filter(ScenarioVariable::isCSVValid).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)) { @@ -213,7 +213,7 @@ public abstract class MsTestElement { csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName()); csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? "UTF-8" : item.getEncoding()); if (CollectionUtils.isNotEmpty(item.getFiles())) { - if (new File(BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()).exists()) { + if (!config.isOperating() && new File(BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()).exists()) { MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ CSV文件不存在 ]"); } csvDataSet.setProperty("filename", BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsLoopController.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsLoopController.java index 30543eeb31..07c1ff4fe0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsLoopController.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsLoopController.java @@ -56,7 +56,7 @@ public class MsLoopController extends MsTestElement { } final HashTree groupTree = controller(tree); if (CollectionUtils.isNotEmpty(config.getVariables())) { - this.addCsvDataSet(groupTree, config.getVariables()); + this.addCsvDataSet(groupTree, config.getVariables(),config); this.addCounter(groupTree, config.getVariables()); this.addRandom(groupTree, config.getVariables()); } diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java index 710ab4b672..060fbd3215 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/unknown/MsJmeterElement.java @@ -58,7 +58,7 @@ public class MsJmeterElement extends MsTestElement { LogUtil.info(((ThreadGroup) scriptWrapper).getName() + "是被禁用线程组不加入执行"); } else { // CSV数据检查文件路径是否还存在 - if (scriptWrapper instanceof CSVDataSet) { + if (!config.isOperating() && scriptWrapper instanceof CSVDataSet) { String path = ((CSVDataSet) scriptWrapper).getPropertyAsString("filename"); if (!new File(path).exists()) { MSException.throwException(StringUtils.isEmpty(((CSVDataSet) scriptWrapper).getName()) ? "CSVDataSet" : ((CSVDataSet) scriptWrapper).getName() + ":[ CSV文件不存在 ]"); diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 907bd6b4cc..f0bce8b17b 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -1,6 +1,6 @@