From ca778d44c9244d14832228d8bce00b47e636168c Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 6 Jun 2022 15:29:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E5=9C=BA=E6=99=AF=E8=B0=83=E8=AF=95=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E5=90=8E=E5=8F=8A=E6=97=B6=E6=81=A2=E5=A4=8D=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=92=8C=E9=A2=84=E5=8A=A0=E8=BD=BD=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/ApiAutomationController.java | 15 ++++++++++----- .../api/automation/scenario/DebugRun.vue | 6 ++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index 663d8d5aa4..60ec6ed8b6 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -198,12 +198,17 @@ public class ApiAutomationController { @PostMapping(value = "/run/debug") @MsAuditLog(module = OperLogModule.API_AUTOMATION, type = OperLogConstants.DEBUG, title = "#request.scenarioName", sourceId = "#request.scenarioId", project = "#request.projectId") - public void runDebug(@RequestPart("request") RunDefinitionRequest request, - @RequestPart(value = "bodyFiles", required = false) List bodyFiles, @RequestPart(value = "scenarioFiles", required = false) List scenarioFiles) { - if (StringUtils.isEmpty(request.getExecuteType())) { - request.setExecuteType(ExecuteType.Debug.name()); + public String runDebug(@RequestPart("request") RunDefinitionRequest request, + @RequestPart(value = "bodyFiles", required = false) List bodyFiles, @RequestPart(value = "scenarioFiles", required = false) List scenarioFiles) { + try { + if (StringUtils.isEmpty(request.getExecuteType())) { + request.setExecuteType(ExecuteType.Debug.name()); + } + apiAutomationService.debugRun(request, bodyFiles, scenarioFiles); + } catch (Exception e) { + return e.getMessage(); } - apiAutomationService.debugRun(request, bodyFiles, scenarioFiles); + return "SUCCESS"; } @PostMapping(value = "/run") diff --git a/frontend/src/business/components/api/automation/scenario/DebugRun.vue b/frontend/src/business/components/api/automation/scenario/DebugRun.vue index afa343cffe..24d7314060 100644 --- a/frontend/src/business/components/api/automation/scenario/DebugRun.vue +++ b/frontend/src/business/components/api/automation/scenario/DebugRun.vue @@ -26,7 +26,6 @@ export default { return { result: {}, loading: false, - runId: "", reqNumber: 0, } }, @@ -87,7 +86,10 @@ export default { url = '/ui/automation/run/debug'; } saveScenario(url, reqObj, this.runData.hashTree, this, (response) => { - this.runId = response.data; + if(response.data !== "SUCCESS"){ + this.$error(response.data ? response.data : this.$t('commons.run_fail')); + this.$emit('errorRefresh'); + } }); }, }