From bf8b9fbec150cd22a365adf04839e58cb67af6fa Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Fri, 26 Aug 2022 17:15:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=9A=84=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E7=94=A8=E4=BE=8B=E6=97=A5=E5=BF=97=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=92=8C=E6=B5=8B=E8=AF=95=E9=85=8D=E7=BD=AE=E6=97=A0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1016326 --user=李玉号 【测试跟踪】导出测试报告,查看性能用例测试结果,日志详情和测试配置看不了 https://www.tapd.cn/55049933/s/1234600 --- .../java/io/metersphere/dto/LogDetailDTO.java | 4 + .../track/dto/TestPlanLoadCaseDTO.java | 7 +- .../track/service/TestPlanService.java | 15 +- .../report/components/LogDetails.vue | 16 +- .../report/components/TestConfiguration.vue | 5 +- .../components/PerformanceAdvancedConfig.vue | 40 ++- .../components/PerformancePressureConfig.vue | 259 +++++++++++------- .../comonents/load/LoadCaseReportView.vue | 4 +- 8 files changed, 221 insertions(+), 129 deletions(-) diff --git a/backend/src/main/java/io/metersphere/dto/LogDetailDTO.java b/backend/src/main/java/io/metersphere/dto/LogDetailDTO.java index b882bf7915..dee4dc6f1c 100644 --- a/backend/src/main/java/io/metersphere/dto/LogDetailDTO.java +++ b/backend/src/main/java/io/metersphere/dto/LogDetailDTO.java @@ -1,12 +1,16 @@ package io.metersphere.dto; +import io.metersphere.base.domain.LoadTestReportLog; import lombok.Getter; import lombok.Setter; +import java.util.List; + @Getter @Setter public class LogDetailDTO { private String resourceId; private String resourceName; private String content; + private List reportLogs; } diff --git a/backend/src/main/java/io/metersphere/track/dto/TestPlanLoadCaseDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestPlanLoadCaseDTO.java index 675fdb4703..7b2a995cc8 100644 --- a/backend/src/main/java/io/metersphere/track/dto/TestPlanLoadCaseDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/TestPlanLoadCaseDTO.java @@ -1,9 +1,9 @@ package io.metersphere.track.dto; import io.metersphere.base.domain.LoadTestReportWithBLOBs; -import io.metersphere.base.domain.TestPlanLoadCase; import io.metersphere.base.domain.TestPlanLoadCaseWithBLOBs; import io.metersphere.dto.LogDetailDTO; +import io.metersphere.dto.TestResourcePoolDTO; import io.metersphere.performance.base.*; import io.metersphere.performance.dto.LoadTestExportJmx; import io.metersphere.performance.dto.MetricData; @@ -35,7 +35,7 @@ public class TestPlanLoadCaseDTO extends TestPlanLoadCaseWithBLOBs { private long startTime; private long endTime; private String fixLoadConfiguration; -// private LoadTestExportJmx jmxContent; + // private LoadTestExportJmx jmxContent; private List fixJmxContent; private TestOverview testOverview; private List loadChartData; @@ -48,6 +48,7 @@ public class TestPlanLoadCaseDTO extends TestPlanLoadCaseWithBLOBs { private List reportErrorsTop5; private List reportLogResource; private List reportResource; - private List metricData; + private List metricData; + private List resourcePools; } } 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 292d7a1c12..036e9e62f9 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -194,6 +194,8 @@ public class TestPlanService { private ExtTestPlanApiScenarioMapper extTestPlanApiScenarioMapper; @Resource private ExtTestPlanUiScenarioMapper extTestPlanUiScenarioMapper; + @Resource + private TestResourcePoolService testResourcePoolService; public synchronized TestPlan addTestPlan(AddTestPlanRequest testPlan) { if (getTestPlanByName(testPlan.getName()).size() > 0) { @@ -1664,9 +1666,8 @@ public class TestPlanService { List jmxContent = performanceReportService.getJmxContent(reportId); if (!CollectionUtils.isEmpty(jmxContent)) { response.setJmxContent(JSONObject.toJSONString(jmxContent.get(0))); + response.setFixJmxContent(jmxContent); } - List fixJmxContent = performanceTestService.getJmxContent(item.getId()); - response.setFixJmxContent(fixJmxContent); // 概览 TestOverview testOverview = performanceReportService.getTestOverview(reportId); @@ -1711,9 +1712,15 @@ public class TestPlanService { // 日志详情 List reportLogResource = performanceReportService.getReportLogResource(reportId); + if (CollectionUtils.isNotEmpty(reportLogResource)) { + for (LogDetailDTO log : reportLogResource) { + List reportLogs = performanceReportService.getReportLogs(reportId, log.getResourceId()); + log.setReportLogs(reportLogs); + } + } response.setReportLogResource(reportLogResource); -// performanceReportService.getReportLogs(reportId, resourceId); - + List testResourcePoolDTOS = testResourcePoolService.listValidQuotaResourcePools(); + response.setResourcePools(testResourcePoolDTOS); List reportResource = metricQueryService.queryReportResource(reportId); response.setReportResource(reportResource); List metricData = metricQueryService.queryMetric(reportId); diff --git a/frontend/src/business/components/performance/report/components/LogDetails.vue b/frontend/src/business/components/performance/report/components/LogDetails.vue index ca4a17d3dd..229f22f6a8 100644 --- a/frontend/src/business/components/performance/report/components/LogDetails.vue +++ b/frontend/src/business/components/performance/report/components/LogDetails.vue @@ -85,7 +85,13 @@ export default { } this.loading = true; if (this.planReportTemplate) { - // this.handleGetLogResourceDetail(this.planReportTemplate.logResourceDetail, resourceId); + let {reportLogResource} = this.planReportTemplate; + if (reportLogResource && reportLogResource.length > 0) { + let {reportLogs} = reportLogResource[0]; + if (reportLogs) { + this.handleGetPlanTemplateLog(reportLogs); + } + } } else if (this.isShare) { getSharePerformanceReportLogResourceDetail(this.shareId, this.id, resourceId, this.page || 1, data => { this.handleGetLogResourceDetail(data, resourceId); @@ -96,6 +102,14 @@ export default { }); } }, + handleGetPlanTemplateLog(data) { + data.forEach(log => { + if (this.logContent) { + this.logContent.push(log); + } + }); + this.loading = false; + }, handleGetLogResourceDetail(data, resourceId) { data.listObject.forEach(log => { if (this.logContent) { diff --git a/frontend/src/business/components/performance/report/components/TestConfiguration.vue b/frontend/src/business/components/performance/report/components/TestConfiguration.vue index 8531cf5c80..acf6df1729 100644 --- a/frontend/src/business/components/performance/report/components/TestConfiguration.vue +++ b/frontend/src/business/components/performance/report/components/TestConfiguration.vue @@ -1,11 +1,11 @@