From 170ddeeacada5920e18644d4c451cc6533e0a62f Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 24 Nov 2021 12:50:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=89=A7=E8=A1=8C=E7=8A=B6=E6=80=81=E4=B8=8D?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E5=AF=BC=E8=87=B4=E7=9A=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1008134 --user=宋天阳 【github#7888】点开执行中的测试计划日志,展示的是之前的旧数据 https://www.tapd.cn/55049933/s/1073942 --- .../metersphere/track/service/TestPlanReportService.java | 7 ++++++- .../track/service/TestPlanScenarioCaseService.java | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) 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); }