From b2dc1a6cd9751b07e4f86c14f2ab685676050d11 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 15 Dec 2022 18:24:01 +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=8D=E5=9C=BA=E6=99=AF=E5=8F=98=E9=87=8F=E4=B8=8D?= =?UTF-8?q?=E9=80=89=E4=BB=BB=E4=BD=95=E7=AD=96=E7=95=A5=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=89=A7=E8=A1=8C=E5=8F=96=E5=8F=82=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020890 --user=赵勇 【接口测试】场景引用其他场景,场景设置中都不勾选,变量引用了原场景变量 https://www.tapd.cn/55049933/s/1316024 --- .../api/dto/definition/request/MsScenario.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 7b7ac7c1cc..d629e2abe6 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 @@ -157,17 +157,16 @@ public class MsScenario extends MsTestElement { // 环境变量 Arguments arguments = arguments(this.isEnvironmentEnable() ? newConfig : config); - if (arguments != null && ((this.variableEnable == null || this.variableEnable) - || (this.mixEnable == null || this.mixEnable))) { + if (arguments != null && !arguments.getArguments().isEmpty()) { Arguments valueSupposeMock = ParameterConfig.valueSupposeMock(arguments); // 这里加入自定义变量解决ForEach循环控制器取值问题,循环控制器无法从vars中取值 - if ((this.variableEnable == null || this.variableEnable) || (this.mixEnable == null || this.mixEnable)) { + if (BooleanUtils.isTrue(this.variableEnable) || BooleanUtils.isTrue(this.mixEnable)) { scenarioTree.add(ElementUtil.argumentsToUserParameters(valueSupposeMock)); - } else { + } else if (config != null && StringUtils.equals(this.getId(), config.getScenarioId())) { scenarioTree.add(valueSupposeMock); } } - if (this.variableEnable == null || this.variableEnable) { + if (this.variableEnable == null || this.variableEnable || BooleanUtils.isTrue(this.mixEnable)) { ElementUtil.addCsvDataSet(scenarioTree, variables, this.isEnvironmentEnable() ? newConfig : config, "shareMode.group"); ElementUtil.addCounter(scenarioTree, variables, false); ElementUtil.addRandom(scenarioTree, variables);