diff --git a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java index 94878518be..81fb282d65 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java @@ -177,6 +177,9 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl } else if (StringUtils.equals(this.runMode, ApiRunMode.JENKINS.name())) { apiDefinitionService.addResult(testResult); apiDefinitionExecResultService.saveApiResult(testResult, ApiRunMode.DEFINITION.name()); + apiTestService.changeStatus(testId, APITestStatus.Completed); + report = apiReportService.getRunningReport(testResult.getTestId()); + apiReportService.complete(testResult, report); } else if (StringUtils.equalsAny(this.runMode, ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name())) { apiDefinitionService.addResult(testResult); diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java index 5b99d9a620..84edbe995d 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java @@ -15,6 +15,7 @@ import io.metersphere.track.dto.TestPlanDTOWithMetric; import io.metersphere.track.request.testcase.PlanCaseRelevanceRequest; import io.metersphere.track.request.testcase.QueryTestPlanRequest; import io.metersphere.track.request.testplan.AddTestPlanRequest; +import io.metersphere.track.request.testplan.TestplanRunRequest; import io.metersphere.track.request.testplancase.TestCaseRelevanceRequest; import io.metersphere.track.service.TestPlanProjectService; import io.metersphere.track.service.TestPlanService; @@ -136,4 +137,8 @@ public class TestPlanController { Page page = PageHelper.startPage(goPage, pageSize, true); return PageUtils.setPageInfo(page, testPlanProjectService.getProjectByPlanId(request)); } + @PostMapping("/testplan/jenkins") + public void runJenkins(@RequestBody TestplanRunRequest testplanRunRequest){ + testPlanService.run(testplanRunRequest.getTestPlanID(),testplanRunRequest.getProjectID(),testplanRunRequest.getUserId(),testplanRunRequest.getTriggerMode()); + } } diff --git a/backend/src/main/java/io/metersphere/track/request/testplan/TestplanRunRequest.java b/backend/src/main/java/io/metersphere/track/request/testplan/TestplanRunRequest.java new file mode 100644 index 0000000000..016c73e65f --- /dev/null +++ b/backend/src/main/java/io/metersphere/track/request/testplan/TestplanRunRequest.java @@ -0,0 +1,15 @@ +package io.metersphere.track.request.testplan; + + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class TestplanRunRequest { + private String testPlanID; + private String projectID; + private String userId; + private String triggerMode; +} +