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 302d138dd3
commit 8ca102f70f
2 changed files with 15 additions and 4 deletions

View File

@ -296,9 +296,14 @@ public class TestPlanController {
return schedule;
}
/***
* 只检查是否有API性能用例
* @param id
* @return
*/
@GetMapping("/have/exec/case/{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) {
//检查测试计划下有没有可以执行的用例
if (!haveExecCase(testplanRunRequest.getTestPlanId())) {
if (!haveExecCase(testplanRunRequest.getTestPlanId(), false)) {
MSException.throwException(Translator.get("plan_warning"));
}
String envType = testplanRunRequest.getEnvironmentType();
@ -1626,7 +1626,7 @@ public class TestPlanService {
testPlanMapper.updateByPrimaryKeySelective(testPlan);
}
public boolean haveExecCase(String planId) {
public boolean haveExecCase(String planId, boolean ignoreUI) {
if (StringUtils.isBlank(planId)) {
return false;
}
@ -1639,6 +1639,12 @@ public class TestPlanService {
return true;
}
if (!ignoreUI) {
if (planTestPlanUiScenarioCaseService.haveUiCase(planId)) {
return true;
}
}
return planTestPlanLoadCaseService.haveExecCase(planId);
}
@ -1781,7 +1787,7 @@ public class TestPlanService {
append.append("/");
}
}
if (!haveExecCase(planList.get(i).getId())) {
if (!haveExecCase(planList.get(i).getId(), false)) {
haveExecCaseBuilder.append(planList.get(i).getName()).append("; ");
}
}