From a5cb70ba08985c544a03cd6ce46eaa4183c0eaf3 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 1 Feb 2021 18:18:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E6=89=A7=E8=A1=8C=E7=BB=93=E6=9E=9C=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/controller/MsIfController.java | 4 ++-- .../java/io/metersphere/api/jmeter/TestResult.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsIfController.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsIfController.java index 61a22081cf..c9e995547c 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsIfController.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsIfController.java @@ -42,10 +42,10 @@ public class MsIfController extends MsTestElement { private IfController ifController() { IfController ifController = new IfController(); ifController.setEnabled(true); - ifController.setName(this.getLabelName()); - ifController.setCondition(this.getCondition()); + ifController.setName(StringUtils.isEmpty(this.getName()) ? "IfController" : this.getName()); ifController.setProperty(TestElement.TEST_CLASS, IfController.class.getName()); ifController.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("IfControllerPanel")); + ifController.setCondition(this.getCondition()); ifController.setEvaluateAll(false); ifController.setUseExpression(true); return ifController; diff --git a/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java b/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java index c8914871e7..77cdebca8b 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java @@ -60,6 +60,18 @@ public class TestResult { item.getSubRequestResults().forEach(subItem -> { subItem.setName(item.getName()); }); + } else { + if (requestResultMap.containsKey(result.getName())) { + requestResultMap.get(result.getName()).add(item); + } else { + List requestResults = new LinkedList<>(); + requestResults.add(item); + requestResultMap.put(result.getName(), requestResults); + } + item.getSubRequestResults().forEach(subItem -> { + subItem.setName(item.getName()); + }); + } }); }