diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java index 113425caa2..61c35610a9 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java @@ -1155,12 +1155,17 @@ public class TestPlanReportService { if (StringUtils.isNotBlank(testPlanReportContent.getScenarioAllCases())) { List 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)); diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java index c333952dd9..9057348730 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java @@ -456,7 +456,7 @@ public class TestPlanScenarioCaseService { String defaultStatus = "Running"; if(isFinish){ - defaultStatus = "Error"; + defaultStatus = "Fail"; } Map 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); }