From edadf20a55d8b7e792cb5c45d209eccf93f7cda9 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Sat, 2 Apr 2022 16:56:45 +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=8E=A5=E5=8F=A3=E8=A6=86=E7=9B=96=E7=8E=87?= =?UTF-8?q?=E7=9A=84=E7=BB=9F=E8=AE=A1=E6=96=B9=E5=BC=8F=EF=BC=8C=E5=BD=93?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=8E=A5=E5=8F=A3=E6=88=96=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=97=B6=E8=A6=86=E7=9B=96=E7=8E=87=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复接口覆盖率的统计方式,当没有接口或场景时覆盖率为0 --- .../java/io/metersphere/api/controller/APITestController.java | 4 ++-- .../java/io/metersphere/api/service/ApiAutomationService.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/controller/APITestController.java b/backend/src/main/java/io/metersphere/api/controller/APITestController.java index fcd0dbfd6e..822ad24f00 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APITestController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APITestController.java @@ -268,7 +268,7 @@ public class APITestController { @GetMapping("/countApiCoverage/{projectId}") public String countApiCoverage(@PathVariable String projectId) { - String returnStr = "100%"; + String returnStr = "0%"; /** * 接口覆盖率 * 接口有案例/被场景引用 : 所有的接口 @@ -289,7 +289,7 @@ public class APITestController { @GetMapping("/countInterfaceCoverage/{projectId}") public String countInterfaceCoverage(@PathVariable String projectId) { - String returnStr = "100%"; + String returnStr = "0%"; /** * 接口覆盖率 * 复制的接口定义/复制或引用的单接口用例/ 添加的自定义请求 url 路径与现有的接口定义一致的请求 diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 0721bb7e91..3daca61c19 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1560,7 +1560,7 @@ public class ApiAutomationService { */ public float countInterfaceCoverage(List allScenarioInfoList, List allEffectiveApiList) { if (allEffectiveApiList == null || allEffectiveApiList.isEmpty()) { - return 100; + return 0; } Map> urlMap = new HashMap<>();