From 871b6c738cd0b99d239c668c52842c550a53e9e9 Mon Sep 17 00:00:00 2001 From: Jianguo-Genius Date: Fri, 22 Nov 2024 18:12:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=8D=A1=E7=89=87=E4=B8=AD=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BD=92=E7=B1=BB=E5=85=AC=E5=BC=8F=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=80=9A=E8=BF=87&=E6=9C=AA=E5=AE=8C=E6=88=90=E5=92=8C?= =?UTF-8?q?=E9=80=9A=E8=BF=87&=E5=B7=B2=E5=AE=8C=E6=88=90=E7=9A=84?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=BD=92=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/TestPlanCoverageDTO.java | 34 +++++++++++-------- .../plan/mapper/ExtTestPlanApiCaseMapper.xml | 2 ++ .../mapper/ExtTestPlanApiScenarioMapper.xml | 2 ++ .../ExtTestPlanFunctionalCaseMapper.xml | 2 ++ .../plan/service/TestPlanService.java | 10 ++++-- 5 files changed, 34 insertions(+), 16 deletions(-) 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();