diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java index 4c0ff020c9..44d0ba1db4 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java @@ -10,6 +10,7 @@ import io.metersphere.base.mapper.TestPlanApiScenarioMapper; import io.metersphere.base.mapper.TestPlanMapper; import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper; import io.metersphere.commons.constants.ApiRunMode; +import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.ServiceUtils; import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.service.ProjectService; @@ -141,6 +142,9 @@ public class TestPlanScenarioCaseService { } } testPlanScenarioRequest.setPlanCaseIds(planCaseIdList); + if (CollectionUtils.isEmpty(planCaseIdList)) { + MSException.throwException("未找到执行场景!"); + } planCaseIdList.forEach(item -> { idStr.append("\"").append(item).append("\"").append(","); }); @@ -151,7 +155,9 @@ public class TestPlanScenarioCaseService { scenarioIds.add(apiScenario.getApiScenarioId()); scenarioIdApiScarionMap.put(apiScenario.getApiScenarioId(), apiScenario.getId()); } - + if(scenarioIdApiScarionMap.isEmpty()){ + MSException.throwException("未找到执行场景!"); + } RunScenarioRequest request = new RunScenarioRequest(); request.setIds(scenarioIds); request.setReportId(testPlanScenarioRequest.getId());