From f96bf643416293267cedc8d464775bd408f65e97 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 30 Jun 2021 11:35:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9C=BA=E6=99=AF=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=EF=BC=8C=E5=8A=9F=E8=83=BD=E6=A1=88=E4=BE=8B?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=EF=BC=8C=E5=9C=BA=E6=99=AF=E6=B5=8B=E8=AF=95?= =?UTF-8?q?-=E5=AF=BC=E5=85=A5=E8=A1=97=E5=8F=A3):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=E5=9C=A8?= =?UTF-8?q?=E5=A4=9A=E6=9D=A1=E5=90=8D=E7=A7=B0=E7=9B=B8=E5=90=8C=E7=9A=84?= =?UTF-8?q?SQL=E8=AF=B7=E6=B1=82=E4=B8=8B=E6=AD=A5=E9=AA=A4=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E5=90=8C?= =?UTF-8?q?=E4=B8=80=E6=A8=A1=E5=9D=97=E4=B8=8B=E7=94=A8=E4=BE=8B=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E9=87=8D=E5=A4=8D=E5=AF=BC=E5=85=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=8E=A5=E5=8F=A3=E6=97=B6=E9=BC=A0=E6=A0=87=E6=82=AC?= =?UTF-8?q?=E5=81=9C=E5=9C=A8ID=E4=B8=8A=E5=BC=B9=E5=87=BA=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=B0=94=E6=B3=A1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复场景测试报告在多条名称相同的SQL请求下步骤统计错误的问题,修复测试用例同一模块下用例可以重复导入的问题,修复场景导入接口时鼠标悬停在ID上弹出编辑气泡的问题 --- .../io/metersphere/api/jmeter/TestResult.java | 9 +-- .../TestCaseDataIgnoreErrorListener.java | 31 ++++++++++ .../excel/listener/TestCaseDataListener.java | 56 +++++++++---------- .../scenario/api/RelevanceApiList.vue | 14 ++--- .../scenario/api/RelevanceCaseList.vue | 14 ++--- 5 files changed, 76 insertions(+), 48 deletions(-) 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 e7616888c1..47da3f8ff9 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/TestResult.java @@ -7,10 +7,7 @@ import lombok.Data; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Data public class TestResult { @@ -112,8 +109,8 @@ public class TestResult { this.setStatus(scenarioNames.toString(), item.getError() > 0); itemAndScenarioName = scenarioNames.toString(); }else{ - //不存在多场景时需要补上步骤名字做唯一判断 - itemAndScenarioName = item.getName()+":"+JSONArray.toJSONString(all_id_names.get(0)); + //不存在多场景时需要补上步骤名字做唯一判断 添加UUID进行处理 + itemAndScenarioName = item.getName()+":"+JSONArray.toJSONString(all_id_names.get(0))+ UUID.randomUUID().toString(); this.setStatus(all_id_names, item.getError() > 0); } diff --git a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataIgnoreErrorListener.java b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataIgnoreErrorListener.java index d8cb49a105..c8e9e9012e 100644 --- a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataIgnoreErrorListener.java +++ b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataIgnoreErrorListener.java @@ -168,8 +168,39 @@ public class TestCaseDataIgnoreErrorListener extends EasyExcelListener { /* 校验用例 */ -// if (testCaseNames.contains(data.getName())) { -// TestCaseWithBLOBs testCase = new TestCaseWithBLOBs(); -// BeanUtils.copyBean(testCase, data); -// testCase.setProjectId(projectId); -// String steps = getSteps(data); -// testCase.setSteps(steps); -// testCase.setType("functional"); -// -// boolean dbExist = testCaseService.exist(testCase); -// boolean excelExist = false; -// -// if (dbExist) { -// // db exist -// stringBuilder.append(Translator.get("test_case_already_exists") + ":" + data.getName() + "; "); -// } else { -// // @Data 重写了 equals 和 hashCode 方法 -// excelExist = excelDataList.contains(data); -// } -// -// if (excelExist) { -// // excel exist -// stringBuilder.append(Translator.get("test_case_already_exists_excel") + ":" + data.getName() + "; "); -// } else { -// excelDataList.add(data); -// } -// -// } else { + if (testCaseNames.contains(data.getName())) { + TestCaseWithBLOBs testCase = new TestCaseWithBLOBs(); + BeanUtils.copyBean(testCase, data); + testCase.setProjectId(projectId); + String steps = getSteps(data); + testCase.setSteps(steps); + testCase.setType("functional"); + + boolean dbExist = testCaseService.exist(testCase); + boolean excelExist = false; + + if (dbExist) { + // db exist + stringBuilder.append(Translator.get("test_case_already_exists") + ":" + data.getName() + "; "); + } else { + // @Data 重写了 equals 和 hashCode 方法 + excelExist = excelDataList.contains(data); + } + + if (excelExist) { + // excel exist + stringBuilder.append(Translator.get("test_case_already_exists_excel") + ":" + data.getName() + "; "); + } else { + excelDataList.add(data); + } + + } else { testCaseNames.add(data.getName()); excelDataList.add(data); -// } + } return stringBuilder.toString(); } diff --git a/frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue b/frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue index fe6523feb6..72a4b258fa 100644 --- a/frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue +++ b/frontend/src/business/components/api/automation/scenario/api/RelevanceApiList.vue @@ -22,13 +22,13 @@ label="ID" min-width="80px" sortable> - + + + + + + + - + + + + + + +