diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java index 055bc7044f..3ebeabdb67 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java @@ -65,6 +65,10 @@ public class ParameterConfig extends MsParameter { * 是否是导入/导出操作 */ private boolean isOperating; + /** + * 导入/导出操作时取样器的testname值 + */ + private String operatingSampleTestName; /** * 项目ID,支持单接口执行 */ diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java index 0bb2c9b624..681f91a7d4 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsDubboSampler.java @@ -83,6 +83,8 @@ public class MsDubboSampler extends MsTestElement { // 非导出操作,且不是启用状态则跳过执行 if (!config.isOperating() && !this.isEnable()) { return; + }else if(config.isOperating() && StringUtils.isNotEmpty(config.getOperatingSampleTestName())){ + this.setName(config.getOperatingSampleTestName()); } if (this.getReferenced() != null && "Deleted".equals(this.getReferenced())) { return; diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java index b40af04acf..4908159df5 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsHTTPSamplerProxy.java @@ -134,6 +134,8 @@ public class MsHTTPSamplerProxy extends MsTestElement { // 非导出操作,且不是启用状态则跳过执行Ms if (!config.isOperating() && !this.isEnable()) { return; + }else if(config.isOperating() && StringUtils.isNotEmpty(config.getOperatingSampleTestName())){ + this.setName(config.getOperatingSampleTestName()); } if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) { boolean ref = this.setRefElement(); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java index 7a72d88b42..3bc640a961 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsJDBCSampler.java @@ -83,6 +83,8 @@ public class MsJDBCSampler extends MsTestElement { // 非导出操作,且不是启用状态则跳过执行 if (config != null && !config.isOperating() && !this.isEnable()) { return; + }else if(config.isOperating() && StringUtils.isNotEmpty(config.getOperatingSampleTestName())){ + this.setName(config.getOperatingSampleTestName()); } if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) { boolean ref = this.setRefElement(); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java index 67d3840eb7..628f5b007a 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/sampler/MsTCPSampler.java @@ -121,6 +121,8 @@ public class MsTCPSampler extends MsTestElement { // 非导出操作,且不是启用状态则跳过执行 if (!config.isOperating() && !this.isEnable()) { return; + }else if(config.isOperating() && StringUtils.isNotEmpty(config.getOperatingSampleTestName())){ + this.setName(config.getOperatingSampleTestName()); } if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) { boolean ref = this.setRefElement(); diff --git a/backend/src/main/java/io/metersphere/api/service/APITestService.java b/backend/src/main/java/io/metersphere/api/service/APITestService.java index 2ff372cf9c..ec7b6c34f1 100644 --- a/backend/src/main/java/io/metersphere/api/service/APITestService.java +++ b/backend/src/main/java/io/metersphere/api/service/APITestService.java @@ -615,6 +615,7 @@ public class APITestService { ParameterConfig config = new ParameterConfig(); config.setProjectId(runRequest.getProjectId()); config.setOperating(true); + config.setOperatingSampleTestName(runRequest.getName()); Map envConfig = new HashMap<>(); Map map = runRequest.getEnvironmentMap();