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 b375f4947f..5259a88796 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 @@ -1,6 +1,7 @@ package io.metersphere.api.dto.definition.request.unknown; import com.alibaba.fastjson.annotation.JSONType; +import io.metersphere.api.dto.definition.request.ElementUtil; import io.metersphere.api.dto.definition.request.ParameterConfig; import io.metersphere.api.dto.definition.request.variable.ScenarioVariable; import io.metersphere.api.dto.scenario.request.BodyFile; @@ -23,6 +24,7 @@ import org.apache.jorphan.collections.HashTree; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; +import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; @@ -77,9 +79,20 @@ public class MsJmeterElement extends MsTestElement { config.getCsvFilePaths().add(csvPath); } } + if (scriptWrapper instanceof TestPlan && tree.size() > 0) { + for (Object obj : tree.keySet()) { + if (obj instanceof CSVDataSet) { + tree.remove(obj); + } + } + } if (config.isOperating()) { elementTree = tree.add(scriptWrapper); + if ((scriptWrapper instanceof ThreadGroup)) { + ElementUtil.addCsvDataSet(elementTree, config.getVariables(), config, "shareMode.thread"); + } + } else if (!(scriptWrapper instanceof TestPlan) && !(scriptWrapper instanceof ThreadGroup)) { elementTree = tree.add(scriptWrapper); } @@ -94,7 +107,6 @@ public class MsJmeterElement extends MsTestElement { } } } - } } catch (Exception ex) { ex.printStackTrace();