From 3155af90f5f86fbc00378ee62ab2ae922f0c255d Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Thu, 31 Dec 2020 15:11:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20jenkins=E6=8E=A5=E5=8F=A3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApiAutomationController.java | 8 +++--- .../base/mapper/ext/ExtTestCaseMapper.xml | 7 +++++ .../mapper/ext/ExtTestPlanTestCaseMapper.java | 2 ++ .../mapper/ext/ExtTestPlanTestCaseMapper.xml | 28 +++++++++++++++++++ .../commons/constants/ApiRunMode.java | 2 +- .../track/controller/TestCaseController.java | 2 +- .../TestPlanTestCaseController.java | 4 +-- .../service/TestPlanTestCaseService.java | 5 ++++ 8 files changed, 50 insertions(+), 8 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 fb49ac9127..2f8fbdbc06 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -85,15 +85,15 @@ public class ApiAutomationController { } @PostMapping(value = "/run") - public void run(@RequestBody RunScenarioRequest request) { + public String run(@RequestBody RunScenarioRequest request) { request.setExecuteType(ExecuteType.Completed.name()); - apiAutomationService.run(request); + return apiAutomationService.run(request); } @PostMapping(value = "/run/batch") - public void runBatch(@RequestBody RunScenarioRequest request) { + public String runBatch(@RequestBody RunScenarioRequest request) { request.setExecuteType(ExecuteType.Saved.name()); - apiAutomationService.run(request); + return apiAutomationService.run(request); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 832e1ffd44..709dffae63 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -333,6 +333,13 @@ and project_id= #{request.projectId} + UNION ALL + select id,name,status,project_id,"scenario" as type from api_scenario + + + and project_id= #{request.projectId} + + + update test_plan_test_case 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 469c3d698b..5dd7a0e5c3 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java +++ b/backend/src/main/java/io/metersphere/commons/constants/ApiRunMode.java @@ -1,5 +1,5 @@ package io.metersphere.commons.constants; public enum ApiRunMode { - RUN, DEBUG,DELIMIT,SCENARIO, API_PLAN, SCENARIO_PLAN + RUN, DEBUG,DELIMIT,SCENARIO, API_PLAN, SCENARIO_PLAN,API } diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index e87d9cd916..ecf8290d04 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -57,7 +57,7 @@ public class TestCaseController { return testCaseService.listTestCase(request); } - + /*jenkins项目下所有接口和性能测试用例*/ @GetMapping("/list/method/{projectId}") public List listByMethod(@PathVariable String projectId) { QueryTestCaseRequest request = new QueryTestCaseRequest(); diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java index cedcf7eeda..0d2d38cbad 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanTestCaseController.java @@ -30,13 +30,13 @@ public class TestPlanTestCaseController { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request)); } - + /*jenkins测试计划下全部用例*/ @GetMapping("/list/{planId}") public List getTestPlanCaseByPlanId(@PathVariable String planId) { QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest(); request.setPlanId(planId); request.setMethod("auto"); - return testPlanTestCaseService.list(request); + return testPlanTestCaseService.listByPlanId(request); } @GetMapping("/list/node/{planId}/{nodePaths}") diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java index cd21abb1e5..a5c3202b41 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java @@ -55,6 +55,11 @@ public class TestPlanTestCaseService { }); return list; } + public List listByPlanId(QueryTestPlanCaseRequest request) { + List list = extTestPlanTestCaseMapper.listByPlanId(request); + + return list; + } public List listByNode(QueryTestPlanCaseRequest request) { List list = extTestPlanTestCaseMapper.listByNode(request);