feat: 创建测试计划
This commit is contained in:
parent
aa0e194e4c
commit
8730b4be89
|
@ -127,7 +127,7 @@ public class TestPlanService {
|
||||||
@Resource
|
@Resource
|
||||||
private ApiScenarioMapper apiScenarioMapper;
|
private ApiScenarioMapper apiScenarioMapper;
|
||||||
|
|
||||||
public synchronized void addTestPlan(AddTestPlanRequest testPlan) {
|
public synchronized String addTestPlan(AddTestPlanRequest testPlan) {
|
||||||
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
||||||
MSException.throwException(Translator.get("plan_name_already_exists"));
|
MSException.throwException(Translator.get("plan_name_already_exists"));
|
||||||
}
|
}
|
||||||
|
@ -156,6 +156,7 @@ public class TestPlanService {
|
||||||
.event(NoticeConstants.Event.CREATE)
|
.event(NoticeConstants.Event.CREATE)
|
||||||
.build();
|
.build();
|
||||||
noticeSendService.send(NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
|
noticeSendService.send(NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
|
||||||
|
return testPlan.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestPlan> getTestPlanByName(String name) {
|
public List<TestPlan> getTestPlanByName(String name) {
|
||||||
|
|
|
@ -109,6 +109,9 @@
|
||||||
@click="savePlan">
|
@click="savePlan">
|
||||||
{{ $t('test_track.confirm') }}
|
{{ $t('test_track.confirm') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button type="primary" @click="testPlanInfo">
|
||||||
|
{{ $t('test_track.planning_execution') }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
@ -170,6 +173,33 @@ export default {
|
||||||
listenGoBack(this.close);
|
listenGoBack(this.close);
|
||||||
this.dialogFormVisible = true;
|
this.dialogFormVisible = true;
|
||||||
},
|
},
|
||||||
|
testPlanInfo() {
|
||||||
|
this.$refs['planFrom'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let param = {};
|
||||||
|
Object.assign(param, this.form);
|
||||||
|
param.name = param.name.trim();
|
||||||
|
if (param.name === '') {
|
||||||
|
this.$warning(this.$t('test_track.plan.input_plan_name'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
param.workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||||
|
if (this.form.tags instanceof Array) {
|
||||||
|
this.form.tags = JSON.stringify(this.form.tags);
|
||||||
|
}
|
||||||
|
param.tags = this.form.tags;
|
||||||
|
this.$post('/test/plan/' + this.operationType, param, response => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.dialogFormVisible = false;
|
||||||
|
this.$router.push('/track/plan/view/' + response.data);
|
||||||
|
// 发送广播,刷新 head 上的最新列表
|
||||||
|
TrackEvent.$emit(LIST_CHANGE);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
savePlan() {
|
savePlan() {
|
||||||
this.$refs['planFrom'].validate((valid) => {
|
this.$refs['planFrom'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<ms-table-header :is-tester-permission="true" :condition.sync="condition"
|
<ms-table-header :is-tester-permission="true" :condition.sync="condition"
|
||||||
@search="initTableData" @create="testPlanCreate"
|
@search="initTableData" @create="testPlanCreate"
|
||||||
|
:create-tip="$t('test_track.plan.create_plan')"
|
||||||
:title="$t('test_track.plan.test_plan')"
|
:title="$t('test_track.plan.test_plan')"
|
||||||
:show-create="false"/>
|
/>
|
||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" v-tester @click="testPlanCreate"/>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue