fix(测试跟踪): 导出的测试报告性能用例日志详情和测试配置无信息
--bug=1016326 --user=李玉号 【测试跟踪】导出测试报告,查看性能用例测试结果,日志详情和测试配置看不了 https://www.tapd.cn/55049933/s/1234600
This commit is contained in:
parent
c6b13415d8
commit
bf8b9fbec1
|
@ -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<LoadTestReportLog> reportLogs;
|
||||
}
|
||||
|
|
|
@ -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<LoadTestExportJmx> fixJmxContent;
|
||||
private TestOverview testOverview;
|
||||
private List<ChartsData> loadChartData;
|
||||
|
@ -49,5 +49,6 @@ public class TestPlanLoadCaseDTO extends TestPlanLoadCaseWithBLOBs {
|
|||
private List<LogDetailDTO> reportLogResource;
|
||||
private List<Monitor> reportResource;
|
||||
private List<MetricData> metricData;
|
||||
private List<TestResourcePoolDTO> resourcePools;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<LoadTestExportJmx> jmxContent = performanceReportService.getJmxContent(reportId);
|
||||
if (!CollectionUtils.isEmpty(jmxContent)) {
|
||||
response.setJmxContent(JSONObject.toJSONString(jmxContent.get(0)));
|
||||
response.setFixJmxContent(jmxContent);
|
||||
}
|
||||
List<LoadTestExportJmx> fixJmxContent = performanceTestService.getJmxContent(item.getId());
|
||||
response.setFixJmxContent(fixJmxContent);
|
||||
|
||||
// 概览
|
||||
TestOverview testOverview = performanceReportService.getTestOverview(reportId);
|
||||
|
@ -1711,9 +1712,15 @@ public class TestPlanService {
|
|||
|
||||
// 日志详情
|
||||
List<LogDetailDTO> reportLogResource = performanceReportService.getReportLogResource(reportId);
|
||||
if (CollectionUtils.isNotEmpty(reportLogResource)) {
|
||||
for (LogDetailDTO log : reportLogResource) {
|
||||
List<LoadTestReportLog> reportLogs = performanceReportService.getReportLogs(reportId, log.getResourceId());
|
||||
log.setReportLogs(reportLogs);
|
||||
}
|
||||
}
|
||||
response.setReportLogResource(reportLogResource);
|
||||
// performanceReportService.getReportLogs(reportId, resourceId);
|
||||
|
||||
List<TestResourcePoolDTO> testResourcePoolDTOS = testResourcePoolService.listValidQuotaResourcePools();
|
||||
response.setResourcePools(testResourcePoolDTOS);
|
||||
List<Monitor> reportResource = metricQueryService.queryReportResource(reportId);
|
||||
response.setReportResource(reportResource);
|
||||
List<MetricData> metricData = metricQueryService.queryMetric(reportId);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<template>
|
||||
<el-tabs>
|
||||
<el-tab-pane :label="$t('load_test.pressure_config')">
|
||||
<performance-pressure-config :is-read-only="true" :test="test" :report="report" :report-id="reportId"
|
||||
<performance-pressure-config :is-read-only="true" :test="test" :report="report" :report-id="reportId" :plan-report-template="planReportTemplate"
|
||||
:is-share="isShare" :share-id="shareId" @fileChange="fileChange"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('load_test.advanced_config')">
|
||||
<performance-advanced-config :is-read-only="true" :report-id="reportId" :report="report" :is-share="isShare"
|
||||
<performance-advanced-config :is-read-only="true" :report-id="reportId" :report="report" :is-share="isShare" :plan-report-template="planReportTemplate"
|
||||
:share-id="shareId" ref="advancedConfig"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
@ -26,6 +26,7 @@ export default {
|
|||
report: Object,
|
||||
isShare: Boolean,
|
||||
shareId: String,
|
||||
planReportTemplate: Object,
|
||||
},
|
||||
methods: {
|
||||
fileChange(threadGroups) {
|
||||
|
|
|
@ -507,6 +507,7 @@ export default {
|
|||
},
|
||||
isShare: Boolean,
|
||||
shareId: String,
|
||||
planReportTemplate: Object,
|
||||
},
|
||||
mounted() {
|
||||
if (this.testId) {
|
||||
|
@ -523,6 +524,14 @@ export default {
|
|||
},
|
||||
csvFiles() {
|
||||
this.refreshCsv();
|
||||
},
|
||||
planReportTemplate: {
|
||||
handler() {
|
||||
if (this.planReportTemplate) {
|
||||
this.getAdvancedConfig();
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -534,9 +543,18 @@ export default {
|
|||
if (this.isShare) {
|
||||
url = '/share/performance/report/get-advanced-config/' + this.shareId + '/' + this.reportId;
|
||||
}
|
||||
if (this.planReportTemplate) {
|
||||
this.handleConfig(JSON.parse(this.planReportTemplate.advancedConfiguration));
|
||||
return;
|
||||
}
|
||||
this.$get(url, (response) => {
|
||||
if (response.data) {
|
||||
let data = JSON.parse(response.data);
|
||||
this.handleConfig(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
handleConfig(data) {
|
||||
this.timeout = data.timeout;
|
||||
this.responseTimeout = data.responseTimeout;
|
||||
this.statusCode = data.statusCode || [];
|
||||
|
@ -549,8 +567,6 @@ export default {
|
|||
this.systemProperties = data.systemProperties || [];
|
||||
this.csvConfig = data.csvConfig;
|
||||
this.refreshCsv();
|
||||
}
|
||||
});
|
||||
},
|
||||
refreshCsv() {
|
||||
if (this.csvConfig && this.csvFiles) {
|
||||
|
|
|
@ -247,6 +247,7 @@
|
|||
<script>
|
||||
import MsChart from "@/business/components/common/chart/MsChart";
|
||||
import {findThreadGroup} from "@/business/components/performance/test/model/ThreadGroup";
|
||||
import {getCurrentProjectID} from "@/common/js/utils";
|
||||
|
||||
const HANDLER = "handler";
|
||||
const THREAD_GROUP_TYPE = "tgType";
|
||||
|
@ -303,6 +304,9 @@ export default {
|
|||
},
|
||||
isShare: Boolean,
|
||||
shareId: String,
|
||||
planReportTemplate: {
|
||||
type: Object
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -385,6 +389,18 @@ export default {
|
|||
},
|
||||
report() {
|
||||
this.resourcePool = this.report.testResourcePoolId;
|
||||
},
|
||||
planReportTemplate: {
|
||||
handler() {
|
||||
if (this.planReportTemplate) {
|
||||
let {resourcePools, testResourcePoolId} = this.planReportTemplate;
|
||||
this.resourcePools = resourcePools;
|
||||
this.resourcePool = testResourcePoolId;
|
||||
this.handleResourcePool(resourcePools);
|
||||
this.getJmxContent();
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -393,35 +409,24 @@ export default {
|
|||
if (this.isShare) {
|
||||
url = '/share/testresourcepool/list/quota/valid';
|
||||
}
|
||||
if (!getCurrentProjectID()) {
|
||||
return;
|
||||
}
|
||||
this.result = this.$get(url, response => {
|
||||
this.resourcePools = response.data;
|
||||
this.handleResourcePool(response.data);
|
||||
});
|
||||
},
|
||||
handleResourcePool(data) {
|
||||
this.resourcePools = data;
|
||||
// 如果当前的资源池无效 设置 null
|
||||
if (response.data.filter(p => p.id === this.resourcePool).length === 0) {
|
||||
if (data.filter(p => p.id === this.resourcePool).length === 0) {
|
||||
this.resourcePool = null;
|
||||
// 标记因资源池无效而将资源池ID置为null
|
||||
this.setPoolNull = true;
|
||||
}
|
||||
|
||||
this.resourcePoolChange();
|
||||
});
|
||||
},
|
||||
getLoadConfig() {
|
||||
let url = '';
|
||||
if (this.testId) {
|
||||
url = '/performance/get-load-config/' + this.testId;
|
||||
}
|
||||
if (this.reportId) {
|
||||
url = '/performance/report/get-load-config/' + this.reportId;
|
||||
}
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
if (this.isShare) {
|
||||
url = '/share/performance/report/get-load-config/' + this.reportId;
|
||||
}
|
||||
this.$get(url, (response) => {
|
||||
if (response.data) {
|
||||
let data = JSON.parse(response.data);
|
||||
handleLoadConfig(data) {
|
||||
for (let i = 0; i < this.threadGroups.length; i++) {
|
||||
data[i].forEach(item => {
|
||||
switch (item.key) {
|
||||
|
@ -518,6 +523,32 @@ export default {
|
|||
}
|
||||
this.resourcePoolChange();
|
||||
this.calculateTotalChart();
|
||||
},
|
||||
getLoadConfig() {
|
||||
let url = '';
|
||||
if (this.testId) {
|
||||
url = '/performance/get-load-config/' + this.testId;
|
||||
}
|
||||
if (this.reportId) {
|
||||
url = '/performance/report/get-load-config/' + this.reportId;
|
||||
}
|
||||
if (this.planReportTemplate) {
|
||||
let {loadConfiguration} = this.planReportTemplate;
|
||||
if (loadConfiguration) {
|
||||
this.handleLoadConfig(JSON.parse(loadConfiguration));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
if (this.isShare) {
|
||||
url = '/share/performance/report/get-load-config/' + this.reportId;
|
||||
}
|
||||
this.$get(url, (response) => {
|
||||
if (response.data) {
|
||||
let data = JSON.parse(response.data);
|
||||
this.handleLoadConfig(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -529,13 +560,18 @@ export default {
|
|||
if (this.reportId) {
|
||||
url = '/performance/report/get-jmx-content/' + this.reportId;
|
||||
}
|
||||
let threadGroups = [];
|
||||
if (this.planReportTemplate) {
|
||||
let {fixJmxContent} = this.planReportTemplate;
|
||||
this.handlePlanReportJmxContent(fixJmxContent, threadGroups);
|
||||
return;
|
||||
}
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
if (this.isShare) {
|
||||
url = '/share/performance/report/get-jmx-content/' + this.reportId;
|
||||
}
|
||||
let threadGroups = [];
|
||||
this.$get(url, (response) => {
|
||||
response.data.forEach(d => {
|
||||
threadGroups = threadGroups.concat(findThreadGroup(d.jmx, d.name));
|
||||
|
@ -548,6 +584,17 @@ export default {
|
|||
this.getLoadConfig();
|
||||
});
|
||||
},
|
||||
handlePlanReportJmxContent(fixJmxContent, threadGroups) {
|
||||
fixJmxContent.forEach(d => {
|
||||
threadGroups = threadGroups.concat(findThreadGroup(d.jmx, d.name));
|
||||
threadGroups.forEach(tg => {
|
||||
tg.options = {};
|
||||
});
|
||||
});
|
||||
this.threadGroups = threadGroups;
|
||||
this.$emit('fileChange', threadGroups);
|
||||
this.getLoadConfig();
|
||||
},
|
||||
resourcePoolChange() {
|
||||
let result = this.resourcePools.filter(p => p.id === this.resourcePool);
|
||||
if (result.length === 1) {
|
||||
|
|
|
@ -134,7 +134,9 @@
|
|||
:share-id="shareId"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('report.test_config')">
|
||||
<ms-test-configuration :report-id="reportId" :report="report" :is-share="isShare" :share-id="shareId"/>
|
||||
<ms-test-configuration :report-id="reportId" :report="report"
|
||||
:plan-report-template="planReportTemplate"
|
||||
:is-share="isShare" :share-id="shareId"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue