fix(测试跟踪): 优化UI报告的查询方式
https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001024331
This commit is contained in:
parent
2c36fdaad8
commit
2d2bf40b3a
|
@ -0,0 +1,18 @@
|
||||||
|
package io.metersphere.plan.request.ui;
|
||||||
|
|
||||||
|
import io.metersphere.dto.TestPlanUiScenarioDTO;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TestPlanUiExecuteReportDTO {
|
||||||
|
private Map<String, String> testPlanUiScenarioIdAndReportIdMap;
|
||||||
|
private Map<String, TestPlanUiScenarioDTO> uiScenarioInfoDTOMap;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package io.metersphere.plan.request.ui;
|
||||||
|
|
||||||
|
|
||||||
|
import io.metersphere.request.PlanSubReportRequest;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public class UiPlanReportRequest extends PlanSubReportRequest {
|
||||||
|
private TestPlanUiExecuteReportDTO testPlanExecuteReportDTO;
|
||||||
|
}
|
|
@ -21,6 +21,8 @@ import io.metersphere.plan.request.TestPlanReportSaveRequest;
|
||||||
import io.metersphere.plan.request.api.ApiPlanReportRequest;
|
import io.metersphere.plan.request.api.ApiPlanReportRequest;
|
||||||
import io.metersphere.plan.request.api.TestPlanRunRequest;
|
import io.metersphere.plan.request.api.TestPlanRunRequest;
|
||||||
import io.metersphere.plan.request.performance.LoadPlanReportDTO;
|
import io.metersphere.plan.request.performance.LoadPlanReportDTO;
|
||||||
|
import io.metersphere.plan.request.ui.TestPlanUiExecuteReportDTO;
|
||||||
|
import io.metersphere.plan.request.ui.UiPlanReportRequest;
|
||||||
import io.metersphere.plan.service.remote.api.*;
|
import io.metersphere.plan.service.remote.api.*;
|
||||||
import io.metersphere.plan.service.remote.performance.PlanLoadTestReportService;
|
import io.metersphere.plan.service.remote.performance.PlanLoadTestReportService;
|
||||||
import io.metersphere.plan.service.remote.performance.PlanTestPlanLoadCaseService;
|
import io.metersphere.plan.service.remote.performance.PlanTestPlanLoadCaseService;
|
||||||
|
@ -1267,6 +1269,28 @@ public class TestPlanReportService {
|
||||||
return returnMap;
|
return returnMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private TestPlanUiExecuteReportDTO parseUiCaseReportMap(String reportStructStr) {
|
||||||
|
TestPlanUiExecuteReportDTO uiExecuteReportDTO = new TestPlanUiExecuteReportDTO();
|
||||||
|
if (StringUtils.isNotEmpty(reportStructStr)) {
|
||||||
|
Map<String, String> uiReportMap = new HashMap<>();
|
||||||
|
Map<String, TestPlanUiScenarioDTO> uiDTOMap = new HashMap<>();
|
||||||
|
List<TestPlanUiScenarioDTO> testPlanUiScenarioDTOList = null;
|
||||||
|
try {
|
||||||
|
testPlanUiScenarioDTOList = JSON.parseArray(reportStructStr, TestPlanUiScenarioDTO.class);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(testPlanUiScenarioDTOList)) {
|
||||||
|
for (TestPlanUiScenarioDTO dto : testPlanUiScenarioDTOList) {
|
||||||
|
uiReportMap.put(dto.getId(), dto.getReportId());
|
||||||
|
uiDTOMap.put(dto.getId(), dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uiExecuteReportDTO.setTestPlanUiScenarioIdAndReportIdMap(uiReportMap);
|
||||||
|
uiExecuteReportDTO.setUiScenarioInfoDTOMap(uiDTOMap);
|
||||||
|
}
|
||||||
|
return uiExecuteReportDTO;
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, String> parseCaseReportMap(String reportStructStr) {
|
private Map<String, String> parseCaseReportMap(String reportStructStr) {
|
||||||
Map<String, String> returnMap = new HashMap<>();
|
Map<String, String> returnMap = new HashMap<>();
|
||||||
if (StringUtils.isNotEmpty(reportStructStr)) {
|
if (StringUtils.isNotEmpty(reportStructStr)) {
|
||||||
|
@ -1343,15 +1367,15 @@ public class TestPlanReportService {
|
||||||
//查找UI测试报告结果
|
//查找UI测试报告结果
|
||||||
if (DiscoveryUtil.hasService(MicroServiceName.UI_TEST)) {
|
if (DiscoveryUtil.hasService(MicroServiceName.UI_TEST)) {
|
||||||
LogUtil.info("测试计划报告【" + testPlanReportContentWithBLOBs.getTestPlanReportId() + "】开始查找UI测试报告结果");
|
LogUtil.info("测试计划报告【" + testPlanReportContentWithBLOBs.getTestPlanReportId() + "】开始查找UI测试报告结果");
|
||||||
Map<String, String> testPlanUiCaseIdAndReportIdMap = this.parseCaseReportMap(testPlanReportContentWithBLOBs.getPlanUiScenarioReportStruct());
|
TestPlanUiExecuteReportDTO uiExecuteReportDTO = this.parseUiCaseReportMap(testPlanReportContentWithBLOBs.getPlanUiScenarioReportStruct());
|
||||||
if (MapUtils.isNotEmpty(testPlanUiCaseIdAndReportIdMap)) {
|
if (MapUtils.isNotEmpty(uiExecuteReportDTO.getTestPlanUiScenarioIdAndReportIdMap())
|
||||||
ApiPlanReportRequest request = new ApiPlanReportRequest();
|
&& MapUtils.isNotEmpty(uiExecuteReportDTO.getUiScenarioInfoDTOMap())) {
|
||||||
request.setConfig(reportConfig);
|
UiPlanReportRequest planSubReportRequest = new UiPlanReportRequest();
|
||||||
request.setPlanId(testPlanId);
|
planSubReportRequest.setTestPlanExecuteReportDTO(uiExecuteReportDTO);
|
||||||
request.setSaveResponse(null);
|
planSubReportRequest.setConfig(reportConfig);
|
||||||
request.setTestPlanExecuteReportDTO(reportDetailDTO);
|
planSubReportRequest.setSaveResponse(false);
|
||||||
try {
|
try {
|
||||||
UiPlanReportDTO uiReport = planTestPlanUiScenarioCaseService.getUiReport(request);
|
UiPlanReportDTO uiReport = planTestPlanUiScenarioCaseService.getUiReport(planSubReportRequest);
|
||||||
reportDetailDTO.setUiPlanReportDTO(uiReport);
|
reportDetailDTO.setUiPlanReportDTO(uiReport);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error("连接Ui-test查找报告结果信息失败!", e);
|
LogUtil.error("连接Ui-test查找报告结果信息失败!", e);
|
||||||
|
|
|
@ -38,6 +38,8 @@ import io.metersphere.plan.request.function.PlanCaseRelevanceRequest;
|
||||||
import io.metersphere.plan.request.function.QueryTestPlanCaseRequest;
|
import io.metersphere.plan.request.function.QueryTestPlanCaseRequest;
|
||||||
import io.metersphere.plan.request.performance.LoadPlanReportDTO;
|
import io.metersphere.plan.request.performance.LoadPlanReportDTO;
|
||||||
import io.metersphere.plan.request.ui.RunUiScenarioRequest;
|
import io.metersphere.plan.request.ui.RunUiScenarioRequest;
|
||||||
|
import io.metersphere.plan.request.ui.TestPlanUiExecuteReportDTO;
|
||||||
|
import io.metersphere.plan.request.ui.UiPlanReportRequest;
|
||||||
import io.metersphere.plan.service.remote.api.PlanApiAutomationService;
|
import io.metersphere.plan.service.remote.api.PlanApiAutomationService;
|
||||||
import io.metersphere.plan.service.remote.api.PlanTestPlanApiCaseService;
|
import io.metersphere.plan.service.remote.api.PlanTestPlanApiCaseService;
|
||||||
import io.metersphere.plan.service.remote.api.PlanTestPlanScenarioCaseService;
|
import io.metersphere.plan.service.remote.api.PlanTestPlanScenarioCaseService;
|
||||||
|
@ -1294,8 +1296,8 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildUiReport(TestPlanReportDataStruct report, Map config, String planId, TestPlanCaseReportResultDTO testPlanExecuteReportDTO, boolean saveResponse) {
|
public void buildUiReport(TestPlanReportDataStruct report, Map config, String planId, TestPlanUiExecuteReportDTO testPlanExecuteReportDTO, boolean saveResponse) {
|
||||||
ApiPlanReportRequest request = new ApiPlanReportRequest();
|
UiPlanReportRequest request = new UiPlanReportRequest();
|
||||||
request.setConfig(config);
|
request.setConfig(config);
|
||||||
request.setPlanId(planId);
|
request.setPlanId(planId);
|
||||||
request.setSaveResponse(saveResponse);
|
request.setSaveResponse(saveResponse);
|
||||||
|
|
|
@ -9,8 +9,8 @@ import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.dto.*;
|
import io.metersphere.dto.*;
|
||||||
import io.metersphere.plan.constant.ApiReportStatus;
|
import io.metersphere.plan.constant.ApiReportStatus;
|
||||||
import io.metersphere.plan.dto.*;
|
import io.metersphere.plan.dto.*;
|
||||||
import io.metersphere.plan.request.api.ApiPlanReportRequest;
|
|
||||||
import io.metersphere.plan.request.api.ApiScenarioRequest;
|
import io.metersphere.plan.request.api.ApiScenarioRequest;
|
||||||
|
import io.metersphere.plan.request.ui.UiPlanReportRequest;
|
||||||
import io.metersphere.plan.service.TestPlanService;
|
import io.metersphere.plan.service.TestPlanService;
|
||||||
import io.metersphere.plan.service.remote.api.PlanTestPlanScenarioCaseService;
|
import io.metersphere.plan.service.remote.api.PlanTestPlanScenarioCaseService;
|
||||||
import io.metersphere.plan.service.remote.api.PlanUiScenarioReportService;
|
import io.metersphere.plan.service.remote.api.PlanUiScenarioReportService;
|
||||||
|
@ -45,7 +45,7 @@ public class PlanTestPlanUiScenarioCaseService extends UiTestService {
|
||||||
return (List<String>) microService.getForData(serviceName, BASE_URL + "/plan/exec/result/" + planId);
|
return (List<String>) microService.getForData(serviceName, BASE_URL + "/plan/exec/result/" + planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UiPlanReportDTO getUiReport(ApiPlanReportRequest request) {
|
public UiPlanReportDTO getUiReport(UiPlanReportRequest request) {
|
||||||
return microService.postForData(serviceName, BASE_URL + "/plan/report", request, UiPlanReportDTO.class);
|
return microService.postForData(serviceName, BASE_URL + "/plan/report", request, UiPlanReportDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue