From 417314a654aad829802a28d1e7c55d88ce807fd1 Mon Sep 17 00:00:00 2001 From: zhangdahai112 Date: Mon, 25 Jul 2022 19:44:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(UI=20=E8=87=AA=E5=8A=A8=E5=8C=96):=20ui?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=E6=8C=87=E4=BB=A4=E6=95=B0?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9=E4=BB=A5=E5=8F=8A=E7=BB=9F=E8=AE=A1=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9=E4=BB=A5=E5=8F=8A=E5=A4=B1=E8=B4=A5=E5=92=8C=E6=9C=AA?= =?UTF-8?q?=E6=89=A7=E8=A1=8Ctab=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1014957 --user=张大海 【UI测试】UI场景,执行后报告指令数量显示不对 https://www.tapd.cn/55049933/s/1211040 --bug=1015050 --user=张大海 【UI测试】UI场景报告中,失败和未执行tab不显示数据 https://www.tapd.cn/55049933/s/1211032 --bug=1015192 --user=张大海 【测试跟踪】ui用例统计分析,步骤数统计的不对 https://www.tapd.cn/55049933/s/1211053 --- .../ApiScenarioReportStructureService.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java index 4c75463a51..12c9fd3dfa 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java @@ -76,6 +76,8 @@ public class ApiScenarioReportStructureService { @Lazy @Resource private ApiScenarioEnvService apiScenarioEnvService; + @Resource + private ApiScenarioReportMapper apiScenarioReportMapper; public void save(List apiScenarios, String reportId, String reportType) { List dtoList = new LinkedList<>(); @@ -279,7 +281,7 @@ public class ApiScenarioReportStructureService { } } - public void reportFormatting(List dtoList, Map> maps) { + public void reportFormatting(List dtoList, Map> maps, String reportType) { // 按照创建时间排序 for (int index = 0; index < dtoList.size(); index++) { StepTreeDTO dto = dtoList.get(index); @@ -325,7 +327,7 @@ public class ApiScenarioReportStructureService { } if (CollectionUtils.isNotEmpty(dto.getChildren())) { - reportFormatting(dto.getChildren(), maps); + reportFormatting(dto.getChildren(), maps, reportType); if (StringUtils.isEmpty(dto.getErrorCode())) { //统计child的errorCode,合并到parent中 @@ -384,7 +386,9 @@ public class ApiScenarioReportStructureService { dto.setTotalStatus(ExecuteResult.FAIL.getValue()); } } - this.orderLoops(dtoList); + if (!reportType.startsWith("UI")) { + this.orderLoops(dtoList); + } } /** @@ -400,8 +404,8 @@ public class ApiScenarioReportStructureService { } // 非正常执行结束的请求结果 List unList = dtoList.stream().filter(e -> e.getValue() != null - && ((StringUtils.equalsIgnoreCase(e.getType(), "DubboSampler") && e.getValue().getStartTime() == 0) - || StringUtils.equalsIgnoreCase(e.getTotalStatus(), ExecuteResult.UN_EXECUTE.toString()))) + && ((StringUtils.equalsIgnoreCase(e.getType(), "DubboSampler") && e.getValue().getStartTime() == 0) + || StringUtils.equalsIgnoreCase(e.getTotalStatus(), ExecuteResult.UN_EXECUTE.toString()))) .collect(Collectors.toList()); // 有效数据按照时间排序 @@ -556,6 +560,7 @@ public class ApiScenarioReportStructureService { private ApiScenarioReportDTO getReport(String reportId, boolean selectContent) { + ApiScenarioReport mainReport = apiScenarioReportMapper.selectByPrimaryKey(reportId); List reportResults = null; if (selectContent) { ApiScenarioReportResultExample example = new ApiScenarioReportResultExample(); @@ -605,7 +610,7 @@ public class ApiScenarioReportStructureService { // 匹配结果 Map> maps = reportResults.stream().collect(Collectors.groupingBy(ApiScenarioReportResult::getResourceId)); - this.reportFormatting(stepList, maps); + this.reportFormatting(stepList, maps, mainReport.getReportType()); reportDTO = this.countReportNum(stepList, reportDTO); // 统计场景数据