fix(测试跟踪): 修复测试计划失败重跑时没有重新计算报告内容的问题
修复测试计划失败重跑时没有重新计算报告内容的问题 Closes #23171
This commit is contained in:
parent
9d0c88b9bc
commit
023bce329f
|
@ -620,7 +620,7 @@ public class TestPlanReportService {
|
||||||
content.setApiBaseCount(null);
|
content.setApiBaseCount(null);
|
||||||
}
|
}
|
||||||
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
|
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) {
|
if (apiBaseCountStruct.getPassRate() == 1) {
|
||||||
testPlanReport.setStatus(TestPlanReportStatus.SUCCESS.name());
|
testPlanReport.setStatus(TestPlanReportStatus.SUCCESS.name());
|
||||||
} else if (apiBaseCountStruct.getPassRate() < 1) {
|
} 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;
|
TestPlanReportDataStruct returnDTO = null;
|
||||||
if (testPlanReport != null && reportContent != null) {
|
if (testPlanReport != null && reportContent != null) {
|
||||||
try {
|
try {
|
||||||
returnDTO = testPlanService.buildTestPlanReportStruct(testPlan, testPlanReport, reportContent);
|
returnDTO = testPlanService.buildReportStruct(testPlan, testPlanReport, reportContent, rebuildReport);
|
||||||
//查找运行环境
|
//查找运行环境
|
||||||
this.initRunInformation(returnDTO, testPlanReport);
|
this.initRunInformation(returnDTO, testPlanReport);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1066,7 +1066,7 @@ public class TestPlanReportService {
|
||||||
}
|
}
|
||||||
if (this.isDynamicallyGenerateReports(testPlanReportContent) || StringUtils.isNotEmpty(testPlanReportContent.getApiBaseCount())) {
|
if (this.isDynamicallyGenerateReports(testPlanReportContent) || StringUtils.isNotEmpty(testPlanReportContent.getApiBaseCount())) {
|
||||||
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
|
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
|
||||||
testPlanReportDTO = this.generateTestPlanReportStruct(testPlan, testPlanReport, testPlanReportContent);
|
testPlanReportDTO = this.genReportStruct(testPlan, testPlanReport, testPlanReportContent, false);
|
||||||
}
|
}
|
||||||
testPlanReportDTO.setId(reportId);
|
testPlanReportDTO.setId(reportId);
|
||||||
testPlanReportDTO.setName(testPlanReport.getName());
|
testPlanReportDTO.setName(testPlanReport.getName());
|
||||||
|
|
|
@ -1383,7 +1383,7 @@ public class TestPlanService {
|
||||||
* @param testPlanReportContentWithBLOBs 测试计划报告内容
|
* @param testPlanReportContentWithBLOBs 测试计划报告内容
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public TestPlanReportDataStruct buildTestPlanReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs) {
|
public TestPlanReportDataStruct buildReportStruct(TestPlanWithBLOBs testPlan, TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs, boolean rebuildReport) {
|
||||||
TestPlanReportDataStruct testPlanReportStruct = null;
|
TestPlanReportDataStruct testPlanReportStruct = null;
|
||||||
if (ObjectUtils.allNotNull(testPlanReport, testPlanReportContentWithBLOBs)) {
|
if (ObjectUtils.allNotNull(testPlanReport, testPlanReportContentWithBLOBs)) {
|
||||||
Map config = null;
|
Map config = null;
|
||||||
|
@ -1392,7 +1392,7 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
testPlanReportStruct = this.getTestPlanReportStructByCreated(testPlanReportContentWithBLOBs);
|
testPlanReportStruct = this.getTestPlanReportStructByCreated(testPlanReportContentWithBLOBs);
|
||||||
//检查是否有已经生成过的测试计划报告内容。如若没有则进行动态计算
|
//检查是否有已经生成过的测试计划报告内容。如若没有则进行动态计算
|
||||||
if (testPlanReportStruct == null) {
|
if (rebuildReport || testPlanReportStruct == null) {
|
||||||
//查询测试计划内的用例信息,然后进行测试计划报告的结果统计
|
//查询测试计划内的用例信息,然后进行测试计划报告的结果统计
|
||||||
TestPlanCaseReportResultDTO testPlanExecuteReportDTO = testPlanReportService.selectCaseDetailByTestPlanReport(config, testPlan.getId(), testPlanReportContentWithBLOBs);
|
TestPlanCaseReportResultDTO testPlanExecuteReportDTO = testPlanReportService.selectCaseDetailByTestPlanReport(config, testPlan.getId(), testPlanReportContentWithBLOBs);
|
||||||
testPlanReportStruct = initTestPlanReportStructData(
|
testPlanReportStruct = initTestPlanReportStructData(
|
||||||
|
@ -2112,7 +2112,7 @@ public class TestPlanService {
|
||||||
TestPlanWithBLOBs testPlanWithBLOBs = this.testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
|
TestPlanWithBLOBs testPlanWithBLOBs = this.testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
|
||||||
TestPlanReportDataStruct testPlanReportDataStruct = new TestPlanReportDataStruct();
|
TestPlanReportDataStruct testPlanReportDataStruct = new TestPlanReportDataStruct();
|
||||||
try {
|
try {
|
||||||
testPlanReportDataStruct = this.buildTestPlanReportStruct(testPlanWithBLOBs, testPlanReport, testPlanReportContent);
|
testPlanReportDataStruct = this.buildReportStruct(testPlanWithBLOBs, testPlanReport, testPlanReportContent, false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LoggerUtil.error("统计测试计划数据出错!", e);
|
LoggerUtil.error("统计测试计划数据出错!", e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue