From d52084793a6034e1d575059159bee90543871a12 Mon Sep 17 00:00:00 2001 From: zhangdahai112 Date: Wed, 31 Aug 2022 01:00:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(UI=20=E8=87=AA=E5=8A=A8=E5=8C=96):=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=EF=BC=8C?= =?UTF-8?q?UI=E7=94=A8=E4=BE=8B=E6=B5=8B=E8=AF=95=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E7=9C=8B=E4=B8=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1016327 --user=张大海 【测试跟踪】导出测试报告,UI用例测试结果看不了 https://www.tapd.cn/55049933/s/1236268 --bug=1016143 --user=张大海 【测试跟踪】分享测试计划报告链接 / 导出测试计划报告,查看ui步骤结果,一直在转圈 https://www.tapd.cn/55049933/s/1236266 --- .../service/ApiScenarioReportStructureService.java | 9 ++++++++- .../io/metersphere/constants/SystemConstants.java | 13 +++++++++++++ .../metersphere/track/service/TestPlanService.java | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 backend/src/main/java/io/metersphere/constants/SystemConstants.java 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 402b3b11ba..fb7e234dda 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java @@ -22,9 +22,11 @@ import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.LogUtil; import io.metersphere.constants.RunModeConstants; +import io.metersphere.constants.SystemConstants; import io.metersphere.dto.RequestResult; import io.metersphere.service.ProjectService; import io.metersphere.utils.LoggerUtil; +import io.metersphere.xpack.ui.dto.UiCommandResult; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.BooleanUtils; @@ -295,7 +297,12 @@ public class ApiScenarioReportStructureService { step.setStepId(reportResults.get(i).getId()); RequestResult result = new RequestResultExpandDTO(reportResult); if (reportResult.getContent() != null) { - result = JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), RequestResult.class); + if (reportType.startsWith(SystemConstants.TestTypeEnum.UI.name())) { + result = JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), UiCommandResult.class); + ((UiCommandResult)result).calTime(); + } else { + result = JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), RequestResult.class); + } } step.setValue(result); step.setTotalStatus(reportResult.getStatus()); diff --git a/backend/src/main/java/io/metersphere/constants/SystemConstants.java b/backend/src/main/java/io/metersphere/constants/SystemConstants.java new file mode 100644 index 0000000000..306d4a3376 --- /dev/null +++ b/backend/src/main/java/io/metersphere/constants/SystemConstants.java @@ -0,0 +1,13 @@ +package io.metersphere.constants; + +/** + * 系统级别通用的常量和枚举 + */ +public final class SystemConstants { + + public enum TestTypeEnum { + API, + UI, + PERFORMANCE; + } +} diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 036e9e62f9..34f9609a90 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -1979,6 +1979,7 @@ public class TestPlanService { buildScenarioResponse(report.getScenarioFailureCases()); buildLoadResponse(report.getLoadAllCases()); buildUiScenarioResponse(report.getUiAllCases()); + buildUiScenarioResponse(report.getUiFailureCases()); report.setLang(lang); render(report, response); }