From a883cd4f37bba419596a44d084121e8aa04e27cd Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 23 Aug 2021 15:05:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E6=96=B9=E5=BC=8F#1006035?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiDefinitionExecResultService.java | 2 ++ .../java/io/metersphere/api/service/TestResultService.java | 4 ++-- .../java/io/metersphere/commons/constants/ApiRunMode.java | 2 +- .../java/io/metersphere/track/service/TestPlanService.java | 6 +++++- .../plan/view/comonents/api/TestPlanApiScenarioList.vue | 4 ++-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java index cfa7cd68d7..7d1a396296 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java @@ -206,6 +206,8 @@ public class ApiDefinitionExecResultService { } if (StringUtils.equals(type, ApiRunMode.JENKINS_API_PLAN.name())) { saveResult.setTriggerMode(TriggerMode.API.name()); + } else if (StringUtils.equals(type, ApiRunMode.MANUAL_PLAN.name())) { + saveResult.setTriggerMode(TriggerMode.MANUAL.name()); } else { saveResult.setTriggerMode(TriggerMode.SCHEDULE.name()); } diff --git a/backend/src/main/java/io/metersphere/api/service/TestResultService.java b/backend/src/main/java/io/metersphere/api/service/TestResultService.java index eb90b5310a..3a1de372cb 100644 --- a/backend/src/main/java/io/metersphere/api/service/TestResultService.java +++ b/backend/src/main/java/io/metersphere/api/service/TestResultService.java @@ -89,9 +89,9 @@ public class TestResultService { reportTask.setExecutionTime(DateUtils.getTimeString(apiTestCaseWithBLOBs.getCreateTime())); reportTask.setExecutionEnvironment(name); //测试计划用例,定时,jenkins - } else if (StringUtils.equalsAny(runMode, ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) { + } else if (StringUtils.equalsAny(runMode, ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name(), ApiRunMode.MANUAL_PLAN.name())) { //测试计划定时任务-接口执行逻辑的话,需要同步测试计划的报告数据 - if (StringUtils.equalsAny(runMode, ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) { + if (StringUtils.equalsAny(runMode, ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name(), ApiRunMode.MANUAL_PLAN.name())) { apiDefinitionExecResultService.saveApiResultByScheduleTask(testResult, debugReportId, runMode); } else { apiDefinitionExecResultService.saveApiResult(testResult, ApiRunMode.API_PLAN.name(), TriggerMode.MANUAL.name()); diff --git a/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java b/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java index 6a62390a97..1f2eec0ab8 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java +++ b/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java @@ -2,5 +2,5 @@ package io.metersphere.commons.constants; public enum ApiRunMode { RUN, DEBUG, DEFINITION, SCENARIO, API_PLAN, JENKINS_API_PLAN, JENKINS_SCENARIO_PLAN, JENKINS_PERFORMANCE_TEST, JENKINS, - SCENARIO_PLAN, API, SCHEDULE_API_PLAN, SCHEDULE_SCENARIO, SCHEDULE_SCENARIO_PLAN, SCHEDULE_PERFORMANCE_TEST + SCENARIO_PLAN, API, SCHEDULE_API_PLAN, SCHEDULE_SCENARIO, SCHEDULE_SCENARIO_PLAN, SCHEDULE_PERFORMANCE_TEST, MANUAL_PLAN } 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 81150c5075..acd200b2e9 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -1090,6 +1090,8 @@ public class TestPlanService { try { if (StringUtils.equals(triggerMode, ReportTriggerMode.API.name())) { apiTestCaseService.run(blobs, UUID.randomUUID().toString(), planReportId, testPlanId, ApiRunMode.JENKINS_API_PLAN.name()); + } else if (StringUtils.equals(triggerMode, ReportTriggerMode.MANUAL.name())) { + apiTestCaseService.run(blobs, UUID.randomUUID().toString(), planReportId, testPlanId, ApiRunMode.MANUAL_PLAN.name()); } else { apiTestCaseService.run(blobs, UUID.randomUUID().toString(), planReportId, testPlanId, ApiRunMode.SCHEDULE_API_PLAN.name()); } @@ -1115,7 +1117,9 @@ public class TestPlanService { if (StringUtils.equals(triggerMode, ReportTriggerMode.API.name())) { scenarioRequest.setTriggerMode(ReportTriggerMode.API.name()); scenarioRequest.setRunMode(ApiRunMode.JENKINS_SCENARIO_PLAN.name()); - + } else if (StringUtils.equals(triggerMode, ReportTriggerMode.MANUAL.name())) { + scenarioRequest.setTriggerMode(ReportTriggerMode.MANUAL.name()); + scenarioRequest.setRunMode(ApiRunMode.JENKINS_SCENARIO_PLAN.name()); } else { scenarioRequest.setTriggerMode(ReportTriggerMode.SCHEDULE.name()); scenarioRequest.setRunMode(ApiRunMode.SCHEDULE_SCENARIO_PLAN.name()); diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue index 7a4474e2d3..981221e019 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue @@ -52,7 +52,7 @@ :fields-width="fieldsWidth" prop="envs" :label="$t('commons.environment')" - min-width="120"> + min-width="150">