From 47617eea2dce9645693e23c7208f3f27ffe69de6 Mon Sep 17 00:00:00 2001 From: BugKing Date: Sat, 18 Dec 2021 15:05:44 +0800 Subject: [PATCH] =?UTF-8?q?revert:=20=E5=9B=9E=E9=80=80"=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E8=8E=B7=E5=8F=96=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=AD=A5=E9=AA=A4=E7=BB=93=E6=9E=9C=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E4=BC=9A=E5=A4=84=E7=90=86=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=9A=84=E9=97=AE=E9=A2=98"=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BF=AE=E6=94=B9=20(#8592)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "fix(测试计划): 修复测试计划获取没有步骤结果场景时不会处理报告记录的问题" This reverts commit 08e27d3cc8c2fadc944171d8fa79a636e7942d15. * Revert "fix(测试计划): 修复测试计划获取没有步骤结果场景时不会处理报告记录的问题" This reverts commit 75e678fc8729ad879e1da8064c4840b193804dbc. --- .../api/service/ApiAutomationService.java | 2 +- .../api/service/ApiScenarioReportService.java | 25 ++----------------- .../service/task/SerialScenarioExecTask.java | 2 +- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 0780785cb7..6cbc4fe29a 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1481,7 +1481,7 @@ public class ApiAutomationService { String testId = executeQueue.get(reportId).getTestId(); if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(executeQueue.get(reportId).getTestId())) { testPlanScenarioId = executeQueue.get(reportId).getTestId(); - testId = reportId; + testId = request.getScenarioTestPlanIdMap().get(executeQueue.get(reportId).getTestId()); } else { testPlanScenarioId = request.getPlanScenarioId(); } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index 55ea4b644f..9fb99478ad 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -292,13 +292,14 @@ public class ApiScenarioReportService { scenario.setExecuteTimes(executeTimes + 1); apiScenarioMapper.updateByPrimaryKey(scenario); + // 发送通知 +// sendNotice(scenario); } } returnReport = report; reportIds.add(report.getId()); MessageCache.executionQueue.remove(report.getId()); } - counterPlanScenarioReport(result); return returnReport; } @@ -425,8 +426,6 @@ public class ApiScenarioReportService { LogUtil.error("未获取到场景报告。 报告ID:" + scenarioResult.getName() + "。 步骤信息:" + JSON.toJSONString(scenarioResult)); } } - // 针对未正常返回结果的报告计数 - counterPlanScenarioReport(result); testPlanLog.info("TestPlanReportId" + JSONArray.toJSONString(testPlanReportIdList) + " EXECUTE OVER. SCENARIO STATUS : " + JSONObject.toJSONString(scenarioAndErrorMap)); for (String reportId : testPlanReportIdList) { TestPlanReportExecuteCatch.updateApiTestPlanExecuteInfo(reportId, null, scenarioAndErrorMap, null); @@ -578,26 +577,6 @@ public class ApiScenarioReportService { } } - private void counterPlanScenarioReport(TestResult result) { - if (CollectionUtils.isEmpty(result.getScenarios()) && StringUtils.isNotEmpty(result.getTestId())) { - ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(result.getTestId()); - if (report != null) { - report.setStatus("Error"); - apiScenarioReportMapper.updateByPrimaryKey(report); - MessageCache.scenarioExecResourceLock.remove(report.getId()); - MessageCache.executionQueue.remove(report.getId()); - if (StringUtils.equals(report.getExecuteType(), ExecuteType.Marge.name()) || StringUtils.equals(report.getScenarioId(), result.getSetReportId())) { - Object obj = MessageCache.cache.get(result.getSetReportId()); - if (obj != null) { - ReportCounter counter = (ReportCounter) obj; - counter.getCompletedIds().add(report.getId()); - MessageCache.cache.put(result.getSetReportId(), counter); - } - } - } - } - } - public ApiScenarioReport updateScenario(TestResult result) { ApiScenarioReport lastReport = null; for (ScenarioResult item : result.getScenarios()) { diff --git a/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java b/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java index 852093f057..f8330260ee 100644 --- a/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java +++ b/backend/src/main/java/io/metersphere/api/service/task/SerialScenarioExecTask.java @@ -52,7 +52,7 @@ public class SerialScenarioExecTask implements Callable { }else { reportId = runModeDataDTO.getTestId(); } - jMeterService.runTest(runModeDataDTO.getReport().getId(), reportId, request.getRunMode(), testPlanScenarioId, request.getConfig()); + jMeterService.runTest(runModeDataDTO.getTestId(), reportId, request.getRunMode(), testPlanScenarioId, request.getConfig()); } else { reportId = runModeDataDTO.getReport().getId(); jMeterService.runLocal(runModeDataDTO.getReport().getId(),request.getConfig(), runModeDataDTO.getHashTree(), TriggerMode.BATCH.name().equals(request.getTriggerMode()) ? TriggerMode.BATCH.name() : request.getReportId(), request.getRunMode());