From dbb1d3d25914885fbfd1de550c06406eb66595ab Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 1 Nov 2022 19:05:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E8=BF=9B=E5=BA=A6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=87=86=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1018889 --user=陈建星 【测试跟踪】测试计划列表,测试进度显示不对 https://www.tapd.cn/55049933/s/1285731 --- .../plan/service/TestPlanService.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java index 4e16ab9f5a..00613221b8 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java @@ -364,15 +364,7 @@ public class TestPlanService { } if (serviceIdSet.contains(MicroServiceName.UI_TEST)) { - List uiScenarioExecResults = calcExecResultStatus(testPlan.getId(), testPlan, planTestPlanUiScenarioCaseService::getExecResultByPlanId); - uiScenarioExecResults.forEach(item -> { - if (StringUtils.isNotBlank(item)) { - testPlan.setTested(testPlan.getTested() + 1); - if (StringUtils.equals(item, "Success")) { - testPlan.setPassed(testPlan.getPassed() + 1); - } - } - }); + calcExecResultStatus(testPlan.getId(), testPlan, planTestPlanUiScenarioCaseService::getExecResultByPlanId); } testPlan.setPassRate(MathUtils.getPercentWithDecimal(testPlan.getTested() == 0 ? 0 : testPlan.getPassed() * 1.0 / testPlan.getTotal())); @@ -385,13 +377,13 @@ public class TestPlanService { * @param planId * @return */ - List calcExecResultStatus(String planId, TestPlanDTOWithMetric testPlan, Function> getResultFunc) { + void calcExecResultStatus(String planId, TestPlanDTOWithMetric testPlan, Function> getResultFunc) { try { List execResults = getResultFunc.apply(planId); execResults.forEach(item -> { - if (StringUtils.isNotBlank(item)) { + if (StringUtils.isNotBlank(item) && !StringUtils.equalsIgnoreCase("UnExecute", item)) { testPlan.setTested(testPlan.getTested() + 1); - if (StringUtils.equalsIgnoreCase(item, "Success")) { + if (StringUtils.equalsIgnoreCase(item, APITestStatus.Success.name())) { testPlan.setPassed(testPlan.getPassed() + 1); } } @@ -400,7 +392,6 @@ public class TestPlanService { } catch (MSException e) { LogUtil.error(e); } - return new ArrayList<>(); } public List listTestPlan(QueryTestPlanRequest request) {