fix(测试计划): 修复性能测试同步更新功能用例状态功能丢失,以及因测试计划报告重构导致的报告内部分用例不显示责任人的问题
修复性能测试同步更新功能用例状态功能丢失,以及因测试计划报告重构导致的报告内部分用例不显示责任人的问题
This commit is contained in:
parent
6c19b4985f
commit
1a4882008c
|
@ -718,7 +718,7 @@ public class TestPlanApiCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestPlanApiDTO> getFailureListByIds(Set<String> planApiCaseIds) {
|
public List<TestPlanApiDTO> getFailureListByIds(Set<String> planApiCaseIds) {
|
||||||
return extTestPlanApiCaseMapper.getFailureListByIds(planApiCaseIds, null);
|
return buildCases(extTestPlanApiCaseMapper.getFailureListByIds(planApiCaseIds, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApiModuleDTO> getNodeByPlanId(List<String> projectIds, String planId, String protocol) {
|
public List<ApiModuleDTO> getNodeByPlanId(List<String> projectIds, String planId, String protocol) {
|
||||||
|
|
|
@ -994,7 +994,7 @@ public class TestPlanScenarioCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestPlanScenarioDTO> getListByIds(Set<String> ids) {
|
public List<TestPlanScenarioDTO> getListByIds(Set<String> ids) {
|
||||||
return extTestPlanScenarioCaseMapper.getFailureListByIds(ids, null);
|
return this.buildCases(extTestPlanScenarioCaseMapper.getFailureListByIds(ids, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestPlanEnvInfoDTO generateEnvironmentInfo(TestPlanReport testPlanReport) {
|
public TestPlanEnvInfoDTO generateEnvironmentInfo(TestPlanReport testPlanReport) {
|
||||||
|
|
|
@ -295,7 +295,7 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="getCases" resultType="io.metersphere.plan.dto.TestPlanLoadCaseDTO">
|
<select id="getCases" resultType="io.metersphere.plan.dto.TestPlanLoadCaseDTO">
|
||||||
select tplc.id, lt.id as caseId, lt.name, lt.num, lt.project_id,
|
select tplc.id, lt.id as caseId, lt.name, lt.num, lt.project_id,
|
||||||
tplc.status ,tplc.create_user, tplc.load_report_id
|
tplc.status ,lt.create_user, tplc.load_report_id
|
||||||
from test_plan_load_case tplc
|
from test_plan_load_case tplc
|
||||||
inner join load_test lt on tplc.load_case_id = lt.id
|
inner join load_test lt on tplc.load_case_id = lt.id
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
|
@ -306,7 +306,7 @@
|
||||||
|
|
||||||
<select id="getCasesByIds" resultType="io.metersphere.plan.dto.TestPlanLoadCaseDTO">
|
<select id="getCasesByIds" resultType="io.metersphere.plan.dto.TestPlanLoadCaseDTO">
|
||||||
select tplc.id, lt.id as caseId, lt.name, lt.num, lt.project_id,
|
select tplc.id, lt.id as caseId, lt.name, lt.num, lt.project_id,
|
||||||
tplc.create_user, tplc.load_report_id
|
lt.create_user, tplc.load_report_id
|
||||||
from test_plan_load_case tplc
|
from test_plan_load_case tplc
|
||||||
inner join load_test lt on tplc.load_case_id = lt.id
|
inner join load_test lt on tplc.load_case_id = lt.id
|
||||||
where tplc.id IN
|
where tplc.id IN
|
||||||
|
|
|
@ -1,24 +1,27 @@
|
||||||
package io.metersphere.plan.notice;
|
package io.metersphere.plan.notice;
|
||||||
|
|
||||||
import io.metersphere.base.domain.LoadTestReport;
|
import io.metersphere.base.domain.LoadTestReport;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanLoadCaseMapper;
|
import io.metersphere.base.domain.TestPlanLoadCaseExample;
|
||||||
|
import io.metersphere.base.domain.TestPlanLoadCaseWithBLOBs;
|
||||||
|
import io.metersphere.base.mapper.TestPlanLoadCaseMapper;
|
||||||
import io.metersphere.commons.constants.PerformanceTestStatus;
|
import io.metersphere.commons.constants.PerformanceTestStatus;
|
||||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||||
import io.metersphere.commons.constants.TestPlanLoadCaseStatus;
|
import io.metersphere.commons.constants.TestPlanLoadCaseStatus;
|
||||||
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.consumer.LoadTestFinishEvent;
|
import io.metersphere.consumer.LoadTestFinishEvent;
|
||||||
|
import io.metersphere.plan.service.PerfQueueService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class LoadReportStatusEvent implements LoadTestFinishEvent {
|
public class LoadReportStatusEvent implements LoadTestFinishEvent {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ExtTestPlanLoadCaseMapper extTestPlanLoadCaseMapper;
|
private TestPlanLoadCaseMapper testPlanLoadCaseMapper;
|
||||||
|
|
||||||
private void updateLoadCaseStatus(LoadTestReport loadTestReport) {
|
private void updateLoadCaseStatus(LoadTestReport loadTestReport) {
|
||||||
String reportId = loadTestReport.getId();
|
String reportId = loadTestReport.getId();
|
||||||
|
@ -32,7 +35,20 @@ public class LoadReportStatusEvent implements LoadTestFinishEvent {
|
||||||
result = TestPlanLoadCaseStatus.success.name();
|
result = TestPlanLoadCaseStatus.success.name();
|
||||||
}
|
}
|
||||||
LogUtil.info("update plan load case status: " + result);
|
LogUtil.info("update plan load case status: " + result);
|
||||||
extTestPlanLoadCaseMapper.updateCaseStatus(reportId, result);
|
// 更新测试计划关联数据状态
|
||||||
|
TestPlanLoadCaseExample example = new TestPlanLoadCaseExample();
|
||||||
|
example.createCriteria().andIdEqualTo(loadTestReport.getTestId());
|
||||||
|
if (testPlanLoadCaseMapper.countByExample(example) > 0) {
|
||||||
|
TestPlanLoadCaseWithBLOBs loadCase = new TestPlanLoadCaseWithBLOBs();
|
||||||
|
loadCase.setId(loadTestReport.getTestId());
|
||||||
|
loadCase.setStatus(TestPlanLoadCaseStatus.success.name());
|
||||||
|
testPlanLoadCaseMapper.updateByPrimaryKeySelective(loadCase);
|
||||||
|
LogUtil.info("Execute test_plan_load_case OVER. Now send kafka to Test_Track. key:" + loadCase.getId());
|
||||||
|
PerfQueueService perfQueueService = CommonBeanFactory.getBean(PerfQueueService.class);
|
||||||
|
if (perfQueueService != null) {
|
||||||
|
perfQueueService.checkTestPlanLoadCaseExecOver(loadCase.getId(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1180,6 +1180,21 @@ public class TestPlanReportService {
|
||||||
testPlanReportContentMapper.insert(content);
|
testPlanReportContentMapper.insert(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, String> parseLoadCaseReportMap(String loadReportStructStr) {
|
||||||
|
Map<String, String> returnMap = new HashMap<>();
|
||||||
|
if (StringUtils.isNotEmpty(loadReportStructStr)) {
|
||||||
|
Map<String, String> caseReportList = null;
|
||||||
|
try {
|
||||||
|
caseReportList = JSON.parseMap(loadReportStructStr);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
if (MapUtils.isNotEmpty(caseReportList)) {
|
||||||
|
returnMap = caseReportList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnMap;
|
||||||
|
}
|
||||||
|
|
||||||
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)) {
|
||||||
|
@ -1236,7 +1251,7 @@ public class TestPlanReportService {
|
||||||
//查找性能测试报告结果
|
//查找性能测试报告结果
|
||||||
if (DiscoveryUtil.hasService(MicroServiceName.PERFORMANCE_TEST)) {
|
if (DiscoveryUtil.hasService(MicroServiceName.PERFORMANCE_TEST)) {
|
||||||
LogUtil.info("测试计划报告【" + testPlanReportContentWithBLOBs.getTestPlanReportId() + "】开始查找性能测试报告结果");
|
LogUtil.info("测试计划报告【" + testPlanReportContentWithBLOBs.getTestPlanReportId() + "】开始查找性能测试报告结果");
|
||||||
Map<String, String> testPlanLoadCaseIdAndReportIdMap = this.parseCaseReportMap(testPlanReportContentWithBLOBs.getPlanLoadCaseReportStruct());
|
Map<String, String> testPlanLoadCaseIdAndReportIdMap = this.parseLoadCaseReportMap(testPlanReportContentWithBLOBs.getPlanLoadCaseReportStruct());
|
||||||
if (MapUtils.isNotEmpty(testPlanLoadCaseIdAndReportIdMap)) {
|
if (MapUtils.isNotEmpty(testPlanLoadCaseIdAndReportIdMap)) {
|
||||||
ApiPlanReportRequest request = new ApiPlanReportRequest();
|
ApiPlanReportRequest request = new ApiPlanReportRequest();
|
||||||
request.setConfig(reportConfig);
|
request.setConfig(reportConfig);
|
||||||
|
|
|
@ -890,7 +890,6 @@ public class TestPlanService {
|
||||||
|
|
||||||
LoggerUtil.info("预生成测试计划报告【" + reportInfoDTO.getTestPlanReport() != null ? reportInfoDTO.getTestPlanReport().getName() : StringUtils.EMPTY + "】计划报告ID[" + planReportId + "]");
|
LoggerUtil.info("预生成测试计划报告【" + reportInfoDTO.getTestPlanReport() != null ? reportInfoDTO.getTestPlanReport().getName() : StringUtils.EMPTY + "】计划报告ID[" + planReportId + "]");
|
||||||
|
|
||||||
|
|
||||||
List<TestPlanApiDTO> apiTestCases = null;
|
List<TestPlanApiDTO> apiTestCases = null;
|
||||||
List<TestPlanScenarioDTO> scenarioCases = null;
|
List<TestPlanScenarioDTO> scenarioCases = null;
|
||||||
List<TestPlanUiScenarioDTO> uiScenarios = null;
|
List<TestPlanUiScenarioDTO> uiScenarios = null;
|
||||||
|
|
Loading…
Reference in New Issue