fix(测试跟踪): 修复测试计划失败重跑时没有重新计算报告内容的问题

修复测试计划失败重跑时没有重新计算报告内容的问题

Closes #23171
This commit is contained in:
song-tianyang 2023-03-27 17:16:18 +08:00 committed by fit2-zhao
parent 9d0c88b9bc
commit 023bce329f
2 changed files with 7 additions and 7 deletions

View File

@ -620,7 +620,7 @@ public class TestPlanReportService {
content.setApiBaseCount(null);
}
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
TestPlanReportDataStruct apiBaseCountStruct = this.generateTestPlanReportStruct(testPlan, testPlanReport, content);
TestPlanReportDataStruct apiBaseCountStruct = this.genReportStruct(testPlan, testPlanReport, content, isRerunningTestPlan);
if (apiBaseCountStruct.getPassRate() == 1) {
testPlanReport.setStatus(TestPlanReportStatus.SUCCESS.name());
} else if (apiBaseCountStruct.getPassRate() < 1) {
@ -675,11 +675,11 @@ public class TestPlanReportService {
}
//构建测试计划报告的数据结构
private TestPlanReportDataStruct generateTestPlanReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs reportContent) {
private TestPlanReportDataStruct genReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs reportContent, boolean rebuildReport) {
TestPlanReportDataStruct returnDTO = null;
if (testPlanReport != null && reportContent != null) {
try {
returnDTO = testPlanService.buildTestPlanReportStruct(testPlan, testPlanReport, reportContent);
returnDTO = testPlanService.buildReportStruct(testPlan, testPlanReport, reportContent, rebuildReport);
//查找运行环境
this.initRunInformation(returnDTO, testPlanReport);
} catch (Exception e) {
@ -1066,7 +1066,7 @@ public class TestPlanReportService {
}
if (this.isDynamicallyGenerateReports(testPlanReportContent) || StringUtils.isNotEmpty(testPlanReportContent.getApiBaseCount())) {
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
testPlanReportDTO = this.generateTestPlanReportStruct(testPlan, testPlanReport, testPlanReportContent);
testPlanReportDTO = this.genReportStruct(testPlan, testPlanReport, testPlanReportContent, false);
}
testPlanReportDTO.setId(reportId);
testPlanReportDTO.setName(testPlanReport.getName());

View File

@ -1383,7 +1383,7 @@ public class TestPlanService {
* @param testPlanReportContentWithBLOBs 测试计划报告内容
* @return
*/
public TestPlanReportDataStruct buildTestPlanReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs) {
public TestPlanReportDataStruct buildReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs, boolean rebuildReport) {
TestPlanReportDataStruct testPlanReportStruct = null;
if (ObjectUtils.allNotNull(testPlanReport, testPlanReportContentWithBLOBs)) {
Map config = null;
@ -1392,7 +1392,7 @@ public class TestPlanService {
}
testPlanReportStruct = this.getTestPlanReportStructByCreated(testPlanReportContentWithBLOBs);
//检查是否有已经生成过的测试计划报告内容如若没有则进行动态计算
if (testPlanReportStruct == null) {
if (rebuildReport || testPlanReportStruct == null) {
//查询测试计划内的用例信息然后进行测试计划报告的结果统计
TestPlanCaseReportResultDTO testPlanExecuteReportDTO = testPlanReportService.selectCaseDetailByTestPlanReport(config, testPlan.getId(), testPlanReportContentWithBLOBs);
testPlanReportStruct = initTestPlanReportStructData(
@ -2112,7 +2112,7 @@ public class TestPlanService {
TestPlanWithBLOBs testPlanWithBLOBs = this.testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
TestPlanReportDataStruct testPlanReportDataStruct = new TestPlanReportDataStruct();
try {
testPlanReportDataStruct = this.buildTestPlanReportStruct(testPlanWithBLOBs, testPlanReport, testPlanReportContent);
testPlanReportDataStruct = this.buildReportStruct(testPlanWithBLOBs, testPlanReport, testPlanReportContent, false);
} catch (Exception e) {
LoggerUtil.error("统计测试计划数据出错!", e);
}