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> - + + + + + + + - + + + + + + +