fix(测试跟踪): 修改校验测试计划是否有可执行用例的判断

--bug=1020120 --user=张大海 【UI测试】禁用本地执行资源池-测试计划-只关联了UI用例-执行计划提示“请选择资源池” https://www.tapd.cn/55049933/s/1303312
This commit is contained in:
zhangdahai112 2022-11-24 12:06:42 +08:00 committed by zhangdahai112
parent ff5de3c432
commit 2bcd6c5089
2 changed files with 15 additions and 4 deletions

View File

@ -296,9 +296,14 @@ public class TestPlanController {
return schedule; return schedule;
} }
/***
* 只检查是否有API性能用例
* @param id
* @return
*/
@GetMapping("/have/exec/case/{id}") @GetMapping("/have/exec/case/{id}")
public boolean haveExecCase(@PathVariable String id) { public boolean haveExecCase(@PathVariable String id) {
return testPlanService.haveExecCase(id); return testPlanService.haveExecCase(id, true);
} }
/** /**

View File

@ -1556,7 +1556,7 @@ public class TestPlanService {
public String runPlan(TestPlanRunRequest testplanRunRequest) { public String runPlan(TestPlanRunRequest testplanRunRequest) {
//检查测试计划下有没有可以执行的用例 //检查测试计划下有没有可以执行的用例
if (!haveExecCase(testplanRunRequest.getTestPlanId())) { if (!haveExecCase(testplanRunRequest.getTestPlanId(), false)) {
MSException.throwException(Translator.get("plan_warning")); MSException.throwException(Translator.get("plan_warning"));
} }
String envType = testplanRunRequest.getEnvironmentType(); String envType = testplanRunRequest.getEnvironmentType();
@ -1626,7 +1626,7 @@ public class TestPlanService {
testPlanMapper.updateByPrimaryKeySelective(testPlan); testPlanMapper.updateByPrimaryKeySelective(testPlan);
} }
public boolean haveExecCase(String planId) { public boolean haveExecCase(String planId, boolean ignoreUI) {
if (StringUtils.isBlank(planId)) { if (StringUtils.isBlank(planId)) {
return false; return false;
} }
@ -1639,6 +1639,12 @@ public class TestPlanService {
return true; return true;
} }
if (!ignoreUI) {
if (planTestPlanUiScenarioCaseService.haveUiCase(planId)) {
return true;
}
}
return planTestPlanLoadCaseService.haveExecCase(planId); return planTestPlanLoadCaseService.haveExecCase(planId);
} }
@ -1781,7 +1787,7 @@ public class TestPlanService {
append.append("/"); append.append("/");
} }
} }
if (!haveExecCase(planList.get(i).getId())) { if (!haveExecCase(planList.get(i).getId(), false)) {
haveExecCaseBuilder.append(planList.get(i).getName()).append("; "); haveExecCaseBuilder.append(planList.get(i).getName()).append("; ");
} }
} }