Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2021-03-22 19:37:51 +08:00
commit a106b22faf
8 changed files with 35 additions and 15 deletions

View File

@ -108,8 +108,16 @@ public class ApiAutomationController {
return apiAutomationService.run(request); 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") @PostMapping(value = "/run/batch")
public String runBatch(@RequestBody RunScenarioRequest request) { public String runBatcah(@RequestBody RunScenarioRequest request) {
request.setExecuteType(ExecuteType.Saved.name()); request.setExecuteType(ExecuteType.Saved.name());
request.setTriggerMode(ApiRunMode.SCENARIO.name()); request.setTriggerMode(ApiRunMode.SCENARIO.name());
request.setRunMode(ApiRunMode.SCENARIO.name()); request.setRunMode(ApiRunMode.SCENARIO.name());

View File

@ -236,7 +236,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
testPlanTestCaseService.updateTestCaseStates(ids, TestPlanTestCaseStatus.Failure.name()); testPlanTestCaseService.updateTestCaseStates(ids, TestPlanTestCaseStatus.Failure.name());
} }
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(e.getMessage(), e);
} }
} }
sendTask(report, reportUrl, testResult); sendTask(report, reportUrl, testResult);

View File

@ -75,6 +75,7 @@
<include refid="condition"> <include refid="condition">
<property name="object" value="${condition}.type"/> <property name="object" value="${condition}.type"/>
</include> </include>
test_case_review_users
</if> </if>
<if test="${condition}.updateTime != null"> <if test="${condition}.updateTime != null">
and test_case.update_time and test_case.update_time
@ -368,7 +369,7 @@
</if> </if>
</where> </where>
UNION ALL 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 type,api_scenario.name,test_plan_api_scenario.status
from test_plan_api_scenario from test_plan_api_scenario
left join left join

View File

@ -3,6 +3,7 @@ package io.metersphere.track.controller;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.metersphere.api.dto.automation.*; import io.metersphere.api.dto.automation.*;
import io.metersphere.commons.constants.ApiRunMode;
import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.Pager;
@ -55,6 +56,14 @@ public class TestPlanScenarioCaseController {
return testPlanScenarioCaseService.run(request); 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") @PostMapping("/batch/update/env")
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public void batchUpdateEnv(@RequestBody RelevanceScenarioRequest request) { public void batchUpdateEnv(@RequestBody RelevanceScenarioRequest request) {

View File

@ -179,17 +179,16 @@ alter table test_plan
alter table test_case alter table test_case
modify method varchar(15) null comment 'Test case method type'; modify method varchar(15) null comment 'Test case method type';
-- add test_case_test -- 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(50) null,
test_case_id varchar(70) null, test_id varchar(50) null,
test_id varchar(70) null, test_type varchar(50) null,
test_type varchar(70) null,
create_time bigint(13) null, create_time bigint(13) null,
update_time bigint(13) null, update_time bigint(13) null,
constraint test_case_test_pk UNIQUE KEY test_case_test_unique_key (test_case_id, test_id)
primary key (id)
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4; DEFAULT CHARSET = utf8mb4 COMMENT ='测试用例和关联用例的关系表';
alter table test_case alter table test_case
modify test_id varchar(2000) null; modify test_id varchar(2000) null;

View File

@ -73,7 +73,6 @@ export const API_STATUS = [
] ]
export const TEST = [ export const TEST = [
{id: 'performance', name: '性能测试'}, {id: 'performance', name: '性能测试'},
{id: 'api', name: '接口测试'},
{id: 'testcase', name: '测试用例'}, {id: 'testcase', name: '测试用例'},
{id: 'automation', name: '场景测试'} {id: 'automation', name: '场景测试'}
] ]

View File

@ -377,7 +377,7 @@ export default {
desc: '', desc: '',
result: '' result: ''
}], }],
selected:[], selected: [],
remark: '', remark: '',
tags: [], tags: [],
demandId: '', demandId: '',
@ -497,6 +497,8 @@ export default {
this.$nextTick(() => (this.isStepTableAlive = true)); this.$nextTick(() => (this.isStepTableAlive = true));
}, },
open(testCase) { open(testCase) {
console.log("测试用例")
console.log(testCase)
this.projectId = getCurrentProjectID(); this.projectId = getCurrentProjectID();
if (window.history && window.history.pushState) { if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL); history.pushState(null, null, document.URL);
@ -580,7 +582,8 @@ export default {
} }
Object.assign(this.form, tmp); Object.assign(this.form, tmp);
this.form.module = testCase.nodeId; this.form.module = testCase.nodeId;
this.form.testId=testCase.testId this.form.testId=testCase.selected
console.log(this.form.testId)
this.getFileMetaData(testCase); this.getFileMetaData(testCase);
}, },
setTestCaseExtInfo(testCase) { setTestCaseExtInfo(testCase) {

View File

@ -274,7 +274,7 @@ export default {
execute(row) { execute(row) {
this.infoDb = false; this.infoDb = false;
let param = this.buildExecuteParam(row); let param = this.buildExecuteParam(row);
console.log(param)
if (this.planId) { if (this.planId) {
this.$post("/test/plan/scenario/case/run", param, response => { this.$post("/test/plan/scenario/case/run", param, response => {
this.runVisible = true; this.runVisible = true;
@ -293,6 +293,7 @@ export default {
// param.id = row.id; // param.id = row.id;
param.id = getUUID(); param.id = getUUID();
param.planScenarioId = row.id; param.planScenarioId = row.id;
console.log(row.id)
param.projectId = row.projectId; param.projectId = row.projectId;
param.planCaseIds = []; param.planCaseIds = [];
param.planCaseIds.push(row.id); param.planCaseIds.push(row.id);