fix(测试计划): 修复执行状态不匹配导致的显示问题

--bug=1008134 --user=宋天阳 【github#7888】点开执行中的测试计划日志,展示的是之前的旧数据
https://www.tapd.cn/55049933/s/1073942
This commit is contained in:
song-tianyang 2021-11-24 12:50:02 +08:00 committed by song-tianyang
parent dd7f4d8140
commit 170ddeeaca
2 changed files with 12 additions and 3 deletions

View File

@ -1155,12 +1155,17 @@ public class TestPlanReportService {
if (StringUtils.isNotBlank(testPlanReportContent.getScenarioAllCases())) {
List<TestPlanFailureScenarioDTO> allCases = JSONObject.parseArray(testPlanReportContent.getScenarioAllCases(), TestPlanFailureScenarioDTO.class);
for (TestPlanFailureScenarioDTO dto : allCases) {
if (StringUtils.equalsIgnoreCase(dto.getLastResult(), "Underway")) {
if (StringUtils.equalsAnyIgnoreCase("Underway",dto.getStatus(), dto.getLastResult())) {
isUpdate = true;
ApiScenarioReport apiReport = apiScenarioReportMapper.selectByPrimaryKey(dto.getReportId());
if (apiReport != null) {
dto.setLastResult(apiReport.getStatus());
dto.setStatus(apiReport.getStatus());
}
}else if (StringUtils.equalsAnyIgnoreCase("Error",dto.getStatus(), dto.getLastResult())) {
isUpdate = true;
dto.setLastResult("Fail");
dto.setStatus("Fail");
}
}
testPlanReportContent.setScenarioAllCases(JSONArray.toJSONString(allCases));

View File

@ -456,7 +456,7 @@ public class TestPlanScenarioCaseService {
String defaultStatus = "Running";
if(isFinish){
defaultStatus = "Error";
defaultStatus = "Fail";
}
Map<String,String> reportStatus = apiScenarioReportService.getReportStatusByReportIds(idMap.values());
for (TestPlanFailureScenarioDTO dto: apiTestCases) {
@ -466,10 +466,14 @@ public class TestPlanScenarioCaseService {
String status = reportStatus.get(reportId);
if(status == null ){
status = defaultStatus;
}else {
if(StringUtils.equalsIgnoreCase(status,"Error")){
status = "Fail";
}
}
dto.setLastResult(status);
dto.setStatus(status);
}
}
return buildCases(apiTestCases);
}