diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCoverageDTO.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCoverageDTO.java index 904268a9ab..ca72429033 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCoverageDTO.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanCoverageDTO.java @@ -34,30 +34,36 @@ public class TestPlanCoverageDTO { private int errorCode; public void archivedAutoIncrement() { - archived++; + this.archived++; } public void notStartedAutoIncrement() { - prepared++; - unExecute++; - notPassed++; + this.prepared++; + this.unExecute++; + this.notPassed++; } - public void successAutoIncrement() { - executed++; - passed++; - finished++; + public void passAndFinishedAutoIncrement() { + this.executed++; + this.passed++; + this.finished++; + } + + public void passAndNotFinishedAutoIncrement() { + this.executed++; + this.passed++; + this.running++; } public void unSuccessAutoIncrement() { - executed++; - notPassed++; - finished++; + this.executed++; + this.notPassed++; + this.finished++; } public void testPlanRunningAutoIncrement() { - executed++; - notPassed++; - running++; + this.executed++; + this.notPassed++; + this.running++; } } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml index be1c23dd08..7dea30fb1e 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml @@ -913,6 +913,8 @@ CASE WHEN resource.last_exec_result is null THEN 'PENDING' + WHEN resource.last_exec_result = '' + THEN 'PENDING' WHEN resource.last_exec_result = '-' THEN 'PENDING' ELSE resource.last_exec_result diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiScenarioMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiScenarioMapper.xml index 01df9caa4a..133be2fcd8 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiScenarioMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiScenarioMapper.xml @@ -685,6 +685,8 @@ THEN 'PENDING' WHEN resource.last_exec_result = '-' THEN 'PENDING' + WHEN resource.last_exec_result = '' + THEN 'PENDING' ELSE resource.last_exec_result END AS execResult from test_plan_api_scenario resource diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.xml index c14adb2fdf..eb3b9cc9b0 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.xml @@ -812,6 +812,8 @@ THEN 'PENDING' WHEN resource.last_exec_result = '-' THEN 'PENDING' + WHEN resource.last_exec_result = '' + THEN 'PENDING' ELSE resource.last_exec_result END AS execResult from test_plan_functional_case resource diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java index 36df6362f5..6d23b2517e 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanService.java @@ -1055,7 +1055,7 @@ public class TestPlanService extends TestPlanBaseUtilsService { //目前只有三个状态。如果同时包含多种状态(进行中/未开始、进行中/已完成、已完成/未开始、进行中/未开始/已完成),根据算法可得测试计划都会是进行中 if (calculateList.size() == 1) { if (calculateList.contains(ResultStatus.SUCCESS.name())) { - returnDTO.successAutoIncrement(); + returnDTO.passAndFinishedAutoIncrement(); } else if (calculateList.contains(ExecStatus.PENDING.name())) { returnDTO.notStartedAutoIncrement(); } else { @@ -1063,7 +1063,13 @@ public class TestPlanService extends TestPlanBaseUtilsService { } } else { if (passphrase > executeRage) { - returnDTO.successAutoIncrement(); + if (calculateList.contains(ExecStatus.PENDING.name())) { + // 通过却未完成 + returnDTO.passAndNotFinishedAutoIncrement(); + } else { + // 通过且完成 + returnDTO.passAndFinishedAutoIncrement(); + } } else if (calculateList.contains(ExecStatus.PENDING.name())) { // 存在还未完成的用例,测试计划为进行中 returnDTO.testPlanRunningAutoIncrement();