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 f42742fece..76084eb565 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -108,8 +108,16 @@ public class ApiAutomationController { return apiAutomationService.run(request); } + @PostMapping(value = "/run/jenkins") + public String runByJenkins(@RequestBody RunScenarioRequest request) { + request.setExecuteType(ExecuteType.Saved.name()); + request.setTriggerMode(ApiRunMode.SCENARIO.name()); + request.setRunMode(ApiRunMode.SCENARIO.name()); + return apiAutomationService.run(request); + } + @PostMapping(value = "/run/batch") - public String runBatch(@RequestBody RunScenarioRequest request) { + public String runBatcah(@RequestBody RunScenarioRequest request) { request.setExecuteType(ExecuteType.Saved.name()); request.setTriggerMode(ApiRunMode.SCENARIO.name()); request.setRunMode(ApiRunMode.SCENARIO.name()); 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 cf82dc8ea1..b64f1bb209 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/APIBackendListenerClient.java @@ -236,7 +236,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl testPlanTestCaseService.updateTestCaseStates(ids, TestPlanTestCaseStatus.Failure.name()); } } catch (Exception e) { - LogUtil.error(e.getMessage(), e); + } } sendTask(report, reportUrl, testResult); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index 495d5ed733..4d85aac3e1 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -75,6 +75,7 @@ + test_case_review_users and test_case.update_time @@ -368,7 +369,7 @@ UNION ALL - SELECT test_plan_api_scenario.id as reportId,test_plan_api_scenario.api_scenario_id as id,"scenario" as + SELECT test_plan_api_scenario.api_scenario_id as testId,test_plan_api_scenario.id as id,"scenario" as type,api_scenario.name,test_plan_api_scenario.status from test_plan_api_scenario left join diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java index af7fe585e1..ee0df8a47d 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanScenarioCaseController.java @@ -3,6 +3,7 @@ package io.metersphere.track.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.api.dto.automation.*; +import io.metersphere.commons.constants.ApiRunMode; import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; @@ -55,6 +56,14 @@ public class TestPlanScenarioCaseController { return testPlanScenarioCaseService.run(request); } + @PostMapping(value = "/jenkins/run") + public String runByRun(@RequestBody RunScenarioRequest request) { + request.setExecuteType(ExecuteType.Saved.name()); + request.setTriggerMode(ApiRunMode.SCENARIO.name()); + request.setRunMode(ApiRunMode.SCENARIO.name()); + return testPlanScenarioCaseService.run(request); + } + @PostMapping("/batch/update/env") @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) public void batchUpdateEnv(@RequestBody RelevanceScenarioRequest request) { diff --git a/backend/src/main/resources/db/migration/V78__v1.8_release.sql b/backend/src/main/resources/db/migration/V78__v1.8_release.sql index 3329cea458..31bc6720a4 100644 --- a/backend/src/main/resources/db/migration/V78__v1.8_release.sql +++ b/backend/src/main/resources/db/migration/V78__v1.8_release.sql @@ -179,17 +179,16 @@ alter table test_plan alter table test_case modify method varchar(15) null comment 'Test case method type'; -- add test_case_test -create table test_case_test +CREATE TABLE IF NOT EXISTS test_case_test ( - id varchar(70) null, - test_case_id varchar(70) null, - test_id varchar(70) null, - test_type varchar(70) null, + test_case_id varchar(50) null, + test_id varchar(50) null, + test_type varchar(50) null, create_time bigint(13) null, update_time bigint(13) null, - constraint test_case_test_pk - primary key (id) + UNIQUE KEY test_case_test_unique_key (test_case_id, test_id) ) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4; + DEFAULT CHARSET = utf8mb4 COMMENT ='测试用例和关联用例的关系表'; + alter table test_case modify test_id varchar(2000) null; \ No newline at end of file diff --git a/frontend/src/business/components/api/definition/model/JsonData.js b/frontend/src/business/components/api/definition/model/JsonData.js index e9e4d441db..280ea6e36d 100644 --- a/frontend/src/business/components/api/definition/model/JsonData.js +++ b/frontend/src/business/components/api/definition/model/JsonData.js @@ -73,7 +73,6 @@ export const API_STATUS = [ ] export const TEST = [ {id: 'performance', name: '性能测试'}, - {id: 'api', name: '接口测试'}, {id: 'testcase', name: '测试用例'}, {id: 'automation', name: '场景测试'} ] diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index d54afef3f5..15193b9724 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -377,7 +377,7 @@ export default { desc: '', result: '' }], - selected:[], + selected: [], remark: '', tags: [], demandId: '', @@ -497,6 +497,8 @@ export default { this.$nextTick(() => (this.isStepTableAlive = true)); }, open(testCase) { + console.log("测试用例") + console.log(testCase) this.projectId = getCurrentProjectID(); if (window.history && window.history.pushState) { history.pushState(null, null, document.URL); @@ -580,7 +582,8 @@ export default { } Object.assign(this.form, tmp); this.form.module = testCase.nodeId; - this.form.testId=testCase.testId + this.form.testId=testCase.selected + console.log(this.form.testId) this.getFileMetaData(testCase); }, setTestCaseExtInfo(testCase) { 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 ef59b7e07c..556f0ba211 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 @@ -274,7 +274,7 @@ export default { execute(row) { this.infoDb = false; let param = this.buildExecuteParam(row); - + console.log(param) if (this.planId) { this.$post("/test/plan/scenario/case/run", param, response => { this.runVisible = true; @@ -293,6 +293,7 @@ export default { // param.id = row.id; param.id = getUUID(); param.planScenarioId = row.id; + console.log(row.id) param.projectId = row.projectId; param.planCaseIds = []; param.planCaseIds.push(row.id);