From 189ce568f77e988a78ccc50e30dcf902c0f33d29 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Tue, 23 Nov 2021 13:51:53 +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=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E7=82=B9=E5=87=BB=E6=9C=AA=E6=89=A7=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E4=BC=9A=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=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/1072863 --- .../track/service/TestPlanApiCaseService.java | 4 ++-- .../track/service/TestPlanScenarioCaseService.java | 2 +- .../metersphere/track/service/TestPlanService.java | 1 - .../report/detail/component/ApiCaseFailureResult.vue | 12 ++++++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java index abf287fd0e..b5e0af62ad 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java @@ -741,13 +741,13 @@ public class TestPlanApiCaseService { String reportId = testPlanApiCaseReportMap.get(testPlanApiCaseId); dto.setReportId(reportId); if(StringUtils.isEmpty(reportId)){ - dto.setStatus(defaultStatus); + dto.setExecResult(defaultStatus); }else { String status = reportResult.get(reportId); if(status == null){ status = defaultStatus; } - dto.setStatus(status); + dto.setExecResult(status); } } return buildCases(apiTestCases); 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 2d4e010ab2..13583b72cc 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanScenarioCaseService.java @@ -511,7 +511,7 @@ public class TestPlanScenarioCaseService { if(status == null ){ status = defaultStatus; } - dto.setStatus(status); + dto.setLastResult(status); } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 77eaca347d..5bbab9d40f 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -1728,7 +1728,6 @@ public class TestPlanService { if (MapUtils.isEmpty(executeInfo.getApiCaseExecInfo()) && MapUtils.isEmpty(executeInfo.getApiScenarioCaseExecInfo())) { return; } - ApiDefinitionExecResultMapper apiDefinitionExecResultMapper = CommonBeanFactory.getBean(ApiDefinitionExecResultMapper.class); if (checkReportConfig(config, "api")) { List apiAllCases = null; List scenarioAllCases = null; diff --git a/frontend/src/business/components/track/plan/view/comonents/report/detail/component/ApiCaseFailureResult.vue b/frontend/src/business/components/track/plan/view/comonents/report/detail/component/ApiCaseFailureResult.vue index 4de1081582..c541cb3729 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/detail/component/ApiCaseFailureResult.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/detail/component/ApiCaseFailureResult.vue @@ -94,7 +94,7 @@ export default { }, data() { return { - apiCases: [], + apiCases: [], result: {}, response: {}, showResponse: false @@ -157,18 +157,22 @@ export default { } }); } else { - if(row.reportId){ + if (row.reportId) { let url = "/api/definition/report/get/" + row.reportId; this.$get(url, response => { if (response.data) { let data = response.data; if (data && data.content) { this.showResponse = true; - this.response = JSON.parse(data.content); + try { + this.response = JSON.parse(data.content); + } catch (e) { + this.response = {}; + } } } }); - }else { + } else { getApiReport(row.id, (data) => { if (data && data.content) { this.showResponse = true;