refactor(测试跟踪): 测试计划报告增加对1.20系列数据的支持

测试计划报告增加对1.20系列数据的支持
This commit is contained in:
song-tianyang 2023-04-06 17:59:23 +08:00 committed by fit2-zhao
parent 8a75fd7ed6
commit 6915cc7147
1 changed files with 26 additions and 0 deletions

View File

@ -1476,12 +1476,38 @@ public class TestPlanService {
testPlanReport,
testPlan, testPlanExecuteReportDTO);
}
//处理旧数据
this.dealOldVersionData(testPlanReportStruct);
//查找运行环境
testPlanReportService.initRunInformation(testPlanReportStruct, testPlanReport);
}
return testPlanReportStruct == null ? new TestPlanReportDataStruct() : testPlanReportStruct;
}
/**
* 处理旧版本数据例如版本升级过程中由于统一了状态字段的数据
*/
private void dealOldVersionData(TestPlanReportDataStruct testPlanReportStruct) {
if (CollectionUtils.isNotEmpty(testPlanReportStruct.getScenarioAllCases())) {
//使用LinkedHashMap是为了确保reportId的一致性同时保证顺序
Map<String, TestPlanScenarioDTO> errorScenarioDTOMap = new LinkedHashMap<>();
if (CollectionUtils.isNotEmpty(testPlanReportStruct.getScenarioFailureCases())) {
testPlanReportStruct.getScenarioFailureCases().forEach(item -> {
if (StringUtils.isNotBlank(item.getReportId())) {
errorScenarioDTOMap.put(item.getReportId(), item);
}
});
}
testPlanReportStruct.getScenarioAllCases().forEach(item -> {
if (StringUtils.equalsIgnoreCase(item.getLastResult(), "Fail")) {
errorScenarioDTOMap.put(item.getReportId(), item);
}
});
testPlanReportStruct.setScenarioFailureCases(new ArrayList<>(errorScenarioDTOMap.values()));
}
}
//获取已生成过的测试计划报告内容
private TestPlanReportDataStruct getTestPlanReportStructByCreated(TestPlanReportContentWithBLOBs
testPlanReportContentWithBLOBs) {