From ef1254c76d1fc0c0c8d447bc8737e61caee75d01 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 6 Apr 2023 11:46:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Djmx=E5=AF=BC=E5=85=A5=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=BD=AC=E6=88=90=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E7=94=9F=E6=88=90jmx=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025157 --user=王孝刚 [性能测试]chrome插件录制的jmx导入接口自动化再转性能测试用例没有加载场景文件 https://www.tapd.cn/55049933/s/1359698 --- .../service/scenario/ApiScenarioService.java | 41 ++++++------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java index 1f02e9b473..00b4960fe8 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java @@ -872,34 +872,19 @@ public class ApiScenarioService { Map envMap = environmentGroupProjectService.getEnvMap(environmentGroupId); scenario.setEnvironmentMap(envMap); } - // 针对导入的jmx 处理 - boolean isUseElement = false; - if (CollectionUtils.isNotEmpty(scenario.getHashTree())) { - for (MsTestElement testElement : scenario.getHashTree()) { - if (testElement instanceof MsJmeterElement) { - isUseElement = true; - } - } - } - if (isUseElement) { - scenario.toHashTree(jmeterHashTree, scenario.getHashTree(), config); - ElementUtil.accuracyHashTree(jmeterHashTree); - repositoryMetadata = ApiFileUtil.getRepositoryFileMetadata(jmeterHashTree); - jmx = scenario.getJmx(jmeterHashTree); - } else { - MsThreadGroup group = new MsThreadGroup(); - group.setLabel(apiScenario.getName()); - group.setName(apiScenario.getName()); - group.setEnableCookieShare(scenario.isEnableCookieShare()); - group.setOnSampleError(scenario.getOnSampleError()); - group.setHashTree(new LinkedList() {{ - this.add(scenario); - }}); - testPlan.getHashTree().add(group); - testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), config); - repositoryMetadata = ApiFileUtil.getRepositoryFileMetadata(jmeterHashTree); - jmx = testPlan.getJmx(jmeterHashTree); - } + + MsThreadGroup group = new MsThreadGroup(); + group.setLabel(apiScenario.getName()); + group.setName(apiScenario.getName()); + group.setEnableCookieShare(scenario.isEnableCookieShare()); + group.setOnSampleError(scenario.getOnSampleError()); + group.setHashTree(new LinkedList() {{ + this.add(scenario); + }}); + testPlan.getHashTree().add(group); + testPlan.toHashTree(jmeterHashTree, testPlan.getHashTree(), config); + repositoryMetadata = ApiFileUtil.getRepositoryFileMetadata(jmeterHashTree); + jmx = testPlan.getJmx(jmeterHashTree); } catch (Exception ex) { LogUtil.error(ex);