feat: 创建测试计划

This commit is contained in:
wenyann 2021-03-16 18:10:15 +08:00
parent aa0e194e4c
commit 8730b4be89
3 changed files with 34 additions and 3 deletions

View File

@ -127,7 +127,7 @@ public class TestPlanService {
@Resource
private ApiScenarioMapper apiScenarioMapper;
public synchronized void addTestPlan(AddTestPlanRequest testPlan) {
public synchronized String addTestPlan(AddTestPlanRequest testPlan) {
if (getTestPlanByName(testPlan.getName()).size() > 0) {
MSException.throwException(Translator.get("plan_name_already_exists"));
}
@ -156,6 +156,7 @@ public class TestPlanService {
.event(NoticeConstants.Event.CREATE)
.build();
noticeSendService.send(NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
return testPlan.getId();
}
public List<TestPlan> getTestPlanByName(String name) {

View File

@ -109,6 +109,9 @@
@click="savePlan">
{{ $t('test_track.confirm') }}
</el-button>
<el-button type="primary" @click="testPlanInfo">
{{ $t('test_track.planning_execution') }}
</el-button>
</div>
</template>
</el-dialog>
@ -170,6 +173,33 @@ export default {
listenGoBack(this.close);
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() {
this.$refs['planFrom'].validate((valid) => {
if (valid) {

View File

@ -3,9 +3,9 @@
<template v-slot:header>
<ms-table-header :is-tester-permission="true" :condition.sync="condition"
@search="initTableData" @create="testPlanCreate"
:create-tip="$t('test_track.plan.create_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>