diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java index 8f4a0e116f..99cf12953a 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanTestCaseService.java @@ -327,25 +327,37 @@ public class TestPlanTestCaseService { switch (type) { case "performance": if (serviceIdSet.contains(MicroServiceName.PERFORMANCE_TEST)) { - LoadTest loadTest = planPerformanceTestService.get(id); - if (loadTest != null) { - dto.setTestName(loadTest.getName()); + try { + LoadTest loadTest = planPerformanceTestService.get(id); + if (loadTest != null) { + dto.setTestName(loadTest.getName()); + } + } catch (Exception e) { + LogUtil.error(e); } } break; case "testcase": if (serviceIdSet.contains(MicroServiceName.API_TEST)) { - ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = planApiTestCaseService.get(id); - if (apiTestCaseWithBLOBs != null) { - dto.setTestName(apiTestCaseWithBLOBs.getName()); + try { + ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = planApiTestCaseService.get(id); + if (apiTestCaseWithBLOBs != null) { + dto.setTestName(apiTestCaseWithBLOBs.getName()); + } + } catch (Exception e) { + LogUtil.error(e); } } break; case "automation": if (serviceIdSet.contains(MicroServiceName.API_TEST)) { - ApiScenarioWithBLOBs apiScenarioWithBLOBs = panApiAutomationService.get(id); - if (apiScenarioWithBLOBs != null) { - dto.setTestName(apiScenarioWithBLOBs.getName()); + try { + ApiScenarioWithBLOBs apiScenarioWithBLOBs = panApiAutomationService.get(id); + if (apiScenarioWithBLOBs != null) { + dto.setTestName(apiScenarioWithBLOBs.getName()); + } + } catch (Exception e) { + LogUtil.error(e); } } break; diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index ec8e8d468e..631171479d 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -2846,29 +2846,41 @@ public class TestCaseService { List uiScenarios = new ArrayList<>(); if (serviceIdSet.contains(MicroServiceName.API_TEST)) { - apiCases = relevanceApiCaseService.getApiCaseByIds( - getTestIds(testCaseTests, TestCaseTestType.testcase.name())); - apiScenarios = relevanceApiCaseService.getScenarioCaseByIds( - getTestIds(testCaseTests, TestCaseTestType.automation.name())); - projectIds.addAll(apiCases.stream().map(s -> s.getProjectId()).collect(Collectors.toList())); - scenarioProjectIds = apiScenarios.stream().map(s -> s.getProjectId()).distinct().collect(Collectors.toList()); - projectIds.addAll(scenarioProjectIds); - versionIds.addAll(apiCases.stream().map(s -> s.getVersionId()).collect(Collectors.toList())); - versionIds.addAll(apiScenarios.stream().map(s -> s.getVersionId()).collect(Collectors.toList())); + try { + apiCases = relevanceApiCaseService.getApiCaseByIds( + getTestIds(testCaseTests, TestCaseTestType.testcase.name())); + apiScenarios = relevanceApiCaseService.getScenarioCaseByIds( + getTestIds(testCaseTests, TestCaseTestType.automation.name())); + projectIds.addAll(apiCases.stream().map(s -> s.getProjectId()).collect(Collectors.toList())); + scenarioProjectIds = apiScenarios.stream().map(s -> s.getProjectId()).distinct().collect(Collectors.toList()); + projectIds.addAll(scenarioProjectIds); + versionIds.addAll(apiCases.stream().map(s -> s.getVersionId()).collect(Collectors.toList())); + versionIds.addAll(apiScenarios.stream().map(s -> s.getVersionId()).collect(Collectors.toList())); + } catch (Exception e) { + LogUtil.error(e); + } } if (serviceIdSet.contains(MicroServiceName.PERFORMANCE_TEST)) { - apiLoadTests = relevanceLoadCaseService.getLoadCaseByIds( - getTestIds(testCaseTests, TestCaseTestType.performance.name())); - projectIds.addAll(apiLoadTests.stream().map(s -> s.getProjectId()).collect(Collectors.toList())); - versionIds.addAll(apiLoadTests.stream().map(l -> l.getVersionId()).collect(Collectors.toList())); + try { + apiLoadTests = relevanceLoadCaseService.getLoadCaseByIds( + getTestIds(testCaseTests, TestCaseTestType.performance.name())); + projectIds.addAll(apiLoadTests.stream().map(s -> s.getProjectId()).collect(Collectors.toList())); + versionIds.addAll(apiLoadTests.stream().map(l -> l.getVersionId()).collect(Collectors.toList())); + } catch (Exception e) { + LogUtil.error(e); + } } if (serviceIdSet.contains(MicroServiceName.UI_TEST)) { - uiScenarios = relevanceUiCaseService.getUiCaseByIds( - getTestIds(testCaseTests, TestCaseTestType.uiAutomation.name())); - projectIds.addAll(uiScenarios.stream().map(s -> s.getProjectId()).collect(Collectors.toList())); - versionIds.addAll(uiScenarios.stream().map(l -> l.getVersionId()).collect(Collectors.toList())); + try { + uiScenarios = relevanceUiCaseService.getUiCaseByIds( + getTestIds(testCaseTests, TestCaseTestType.uiAutomation.name())); + projectIds.addAll(uiScenarios.stream().map(s -> s.getProjectId()).collect(Collectors.toList())); + versionIds.addAll(uiScenarios.stream().map(l -> l.getVersionId()).collect(Collectors.toList())); + } catch (Exception e) { + LogUtil.error(e); + } }