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); }