refactor(测试计划): 执行测试计划时去掉重复的方法调用

This commit is contained in:
CaptainB 2022-10-10 16:23:05 +08:00 committed by 刘瑞斌
parent 230d86c8fa
commit f45e15f025
1 changed files with 7 additions and 6 deletions

View File

@ -366,12 +366,13 @@ public class TestPlanService {
/** /**
* 出现异常不回滚继续计算其他 * 出现异常不回滚继续计算其他
*
* @param planId * @param planId
* @return * @return
*/ */
List<String> calcExecResultStatus(String planId,TestPlanDTOWithMetric testPlan, Function<String, List<String>> getResultFunc) { List<String> calcExecResultStatus(String planId, TestPlanDTOWithMetric testPlan, Function<String, List<String>> getResultFunc) {
try { try {
List<String> execResults = getResultFunc.apply(planId); List<String> execResults = getResultFunc.apply(planId);
execResults.forEach(item -> { execResults.forEach(item -> {
if (StringUtils.isNotBlank(item)) { if (StringUtils.isNotBlank(item)) {
testPlan.setTested(testPlan.getTested() + 1); testPlan.setTested(testPlan.getTested() + 1);
@ -589,7 +590,7 @@ public class TestPlanService {
apiCaseIds.add(l.getTestId()); apiCaseIds.add(l.getTestId());
} }
if (StringUtils.equals(l.getTestType(), TestCaseTestStatus.automation.name())) { if (StringUtils.equals(l.getTestType(), TestCaseTestStatus.automation.name())) {
scenarioIds.add(l.getTestId()); scenarioIds.add(l.getTestId());
} }
} }
try { try {
@ -1271,7 +1272,7 @@ public class TestPlanService {
} }
public Boolean checkReportConfig(Map config, String key) { public Boolean checkReportConfig(Map config, String key) {
return ServiceUtils.checkConfigEnable(config, key); return ServiceUtils.checkConfigEnable(config, key);
} }
@ -1410,7 +1411,7 @@ public class TestPlanService {
public String runPlan(TestPlanRunRequest testplanRunRequest) { public String runPlan(TestPlanRunRequest testplanRunRequest) {
//检查测试计划下有没有可以执行的用例 //检查测试计划下有没有可以执行的用例
if (!haveExecCase(testplanRunRequest.getTestPlanId()) && !haveUiCase(testplanRunRequest.getTestPlanId())) { if (!haveExecCase(testplanRunRequest.getTestPlanId())) {
MSException.throwException(Translator.get("plan_warning")); MSException.throwException(Translator.get("plan_warning"));
} }
String envType = testplanRunRequest.getEnvironmentType(); String envType = testplanRunRequest.getEnvironmentType();
@ -1637,7 +1638,7 @@ public class TestPlanService {
append.append("/"); append.append("/");
} }
} }
if (!haveExecCase(planList.get(i).getId()) && !haveUiCase(planList.get(i).getId())) { if (!haveExecCase(planList.get(i).getId())) {
haveExecCaseBuilder.append(planList.get(i).getName()).append("; "); haveExecCaseBuilder.append(planList.get(i).getName()).append("; ");
} }
} }