用例管理国际化

This commit is contained in:
chenjianxing 2020-03-30 00:18:36 +08:00
parent 7382c4dcc3
commit 8b1e4f2a79
11 changed files with 139 additions and 245 deletions

View File

@ -1,18 +1,18 @@
package io.metersphere.service;
import io.metersphere.base.domain.*;
import io.metersphere.base.domain.TestCase;
import io.metersphere.base.domain.TestCaseExample;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.TestCaseNodeMapper;
import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.controller.request.testcase.QueryTestCaseRequest;
import io.metersphere.dto.TestCaseNodeDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.List;
import java.util.UUID;
@Service
@Transactional(rollbackFor = Exception.class)

View File

@ -13,5 +13,6 @@
"run_load_test_file_not_found": "Unable to run test, unable to get test file meta information, test ID:",
"run_load_test_file_content_not_found": "Cannot run test, cannot get test file content, test ID:",
"run_load_test_file_init_error": "Failed to run test, failed to initialize run environment, test ID:",
"load_test_is_running": "Load test is running, please wait."
"load_test_is_running": "Load test is running, please wait.",
"node_deep_limit": "The node depth does not exceed 5 layers!"
}

View File

@ -13,5 +13,6 @@
"run_load_test_file_not_found": "无法运行测试无法获取测试文件元信息测试ID",
"run_load_test_file_content_not_found": "无法运行测试无法获取测试文件内容测试ID",
"run_load_test_file_init_error": "无法运行测试初始化运行环境失败测试ID",
"load_test_is_running": "测试正在运行, 请等待"
"load_test_is_running": "测试正在运行, 请等待",
"node_deep_limit": "节点深度不超过5层"
}

View File

@ -28,7 +28,6 @@ import TrackHome from "../../track/home/TrackHome";
import TestPlan from "../../track/plan/TestPlan";
import TestCase from "../../track/case/TestCase";
import TestTrack from "../../track/TestTrack";
import EditTestCase from "../../track/case/EditTestCase";
Vue.use(VueRouter);
@ -203,23 +202,6 @@ const router = new VueRouter({
name: 'trackHome',
component: TrackHome,
},
{
path: 'case/create',
name: "createCase",
component: EditTestCase,
},
{
path: "case/edit/:caseId",
name: "editCase",
component: EditTestCase,
props: {
content: (route) => {
return {
...route.params
}
}
}
},
{
path: 'case/:caseId',
name: 'testCase',

View File

@ -1,157 +0,0 @@
<template>
<div class="edit-testplan-container">
<el-container>
<el-aside width="200px">
<el-tree
:data="data"
node-key="id"
default-expand-all
@node-drag-start="handleDragStart"
@node-drag-enter="handleDragEnter"
@node-drag-leave="handleDragLeave"
@node-drag-over="handleDragOver"
@node-drag-end="handleDragEnd"
@node-drop="handleDrop"
draggable
:allow-drop="allowDrop"
:allow-drag="allowDrag">
</el-tree>
</el-aside>
<el-main>
main
</el-main>
</el-container>
</div>
</template>
<script>
export default {
name: "EditTestCase",
components: {
},
data() {
return {
data: [{
id: 1,
label: '一级 1',
children: [{
id: 4,
label: '二级 1-1',
children: [{
id: 9,
label: '三级 1-1-1'
}, {
id: 10,
label: '三级 1-1-2'
}]
}]
}, {
id: 2,
label: '一级 2',
children: [{
id: 5,
label: '二级 2-1'
}, {
id: 6,
label: '二级 2-2'
}]
}, {
id: 3,
label: '一级 3',
children: [{
id: 7,
label: '二级 3-1'
}, {
id: 8,
label: '二级 3-2',
children: [{
id: 11,
label: '三级 3-2-1'
}, {
id: 12,
label: '三级 3-2-2'
}, {
id: 13,
label: '三级 3-2-3'
}]
}]
}],
defaultProps: {
children: 'children',
label: 'label'
}
};
},
methods: {
handleDragStart(node, ev) {
console.log('drag start', node);
},
handleDragEnter(draggingNode, dropNode, ev) {
console.log('tree drag enter: ', dropNode.label);
},
handleDragLeave(draggingNode, dropNode, ev) {
console.log('tree drag leave: ', dropNode.label);
},
handleDragOver(draggingNode, dropNode, ev) {
console.log('tree drag over: ', dropNode.label);
},
handleDragEnd(draggingNode, dropNode, dropType, ev) {
console.log('tree drag end: ', dropNode && dropNode.label, dropType);
},
handleDrop(draggingNode, dropNode, dropType, ev) {
console.log('tree drop: ', dropNode.label, dropType);
},
allowDrop(draggingNode, dropNode, type) {
if (dropNode.data.label === '二级 3-1') {
return type !== 'inner';
} else {
return true;
}
},
allowDrag(draggingNode) {
return draggingNode.data.label.indexOf('三级 3-2-2') === -1;
}
}
}
</script>
<style scoped>
.edit-testplan-container {
float: none;
text-align: center;
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
}
.edit-testplan-container .main-content {
margin: 0 auto;
width: 100%;
max-width: 1200px;
}
.edit-testplan-container .testplan-config {
margin-top: 15px;
}
.el-select {
min-width: 130px;
}
.edit-testplan-container .input-with-select .el-input-group__prepend {
background-color: #fff;
}
.advanced-config {
height: calc(100vh - 280px);
overflow: auto;
}
</style>

View File

@ -96,8 +96,8 @@
},
checkProject() {
if(this.currentProject === null) {
this.$alert('该工作空间下无项目,请先创建项目', '创建项目', {
confirmButtonText: '去创建项目',
this.$alert(this.$t('test_track.no_project'), {
confirmButtonText: this.$t('project.create'),
callback: action => {
this.$router.push("/track/project/create");
}

View File

@ -2,7 +2,7 @@
<div>
<el-input placeholder="搜索模块" v-model="filterText"
<el-input :placeholder="$t('test_track.search_module')" v-model="filterText"
size="small">
<el-button slot="append" icon="el-icon-folder-add" @click="openEditNodeDialog('add')"></el-button>
</el-input>
@ -32,25 +32,25 @@
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<div @click="openEditNodeDialog('edit', data)">重命名</div>
<div @click="openEditNodeDialog('edit', data)">{{$t('test_track.rename')}}</div>
</el-dropdown-item>
<el-dropdown-item >
<div @click="openEditNodeDialog('add', data)">添加子模块</div>
<div @click="openEditNodeDialog('add', data)">{{$t('test_track.add_submodule')}}</div>
</el-dropdown-item>
<el-dropdown-item>
<div @click="remove(node, data)">删除</div>
<div @click="remove(node, data)">{{$t('commons.delete')}}</div>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
</el-tree>
<el-dialog title="添加模块" :visible.sync="dialogFormVisible" width="500px">
<el-dialog :title="$t('test_track.add_module')" :visible.sync="dialogFormVisible" width="500px">
<el-row type="flex" justify="center">
<el-col :span="18">
<el-form :model="form">
<el-form-item label="模块名称" :label-width="formLabelWidth">
<el-form-item :label="$t('test_track.module_name')" :label-width="formLabelWidth">
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
</el-form>
@ -58,8 +58,8 @@
</el-row>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="editNode"> </el-button>
<el-button @click="dialogFormVisible = false">{{$t('test_track.cancel')}}</el-button>
<el-button type="primary" @click="editNode">{{$t('test_track.confirm')}}</el-button>
</div>
</el-dialog>

View File

@ -2,15 +2,15 @@
<div>
<el-dialog title="新建用例" :visible.sync="dialogFormVisible" width="65%">
<el-dialog :title="$t('test_track.create')" :visible.sync="dialogFormVisible" width="65%">
<el-form :model="form" :rules="rules" ref="caseFrom">
<el-row>
<el-col :span="8" :offset="1">
<el-form-item
placeholder="请输入内容"
label="用例名称"
:placeholder="$t('test_track.input_name')"
:label="$t('test_track.name')"
:label-width="formLabelWidth"
prop="name">
<el-input v-model="form.name"></el-input>
@ -18,10 +18,10 @@
</el-col>
<el-col :span="11" :offset="2">
<el-form-item label="所属模块" :label-width="formLabelWidth" prop="module">
<el-form-item :label="$t('test_track.module')" :label-width="formLabelWidth" prop="module">
<el-select
v-model="form.module"
placeholder="请选择模块"
:placeholder="$t('test_track.input_module')"
filterable>
<el-option
v-for="item in moduleOptions"
@ -36,8 +36,8 @@
<el-row>
<el-col :span="10" :offset="1">
<el-form-item label="维护人" :label-width="formLabelWidth" prop="maintainer">
<el-select v-model="form.maintainer" placeholder="请选择维护人" filterable>
<el-form-item :label="$t('test_track.maintainer')" :label-width="formLabelWidth" prop="maintainer">
<el-select v-model="form.maintainer" :placeholder="$t('test_track.input_maintainer')" filterable>
<el-option
v-for="item in maintainerOptions"
:key="item.id"
@ -48,8 +48,8 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="优先级" :label-width="formLabelWidth" prop="priority">
<el-select v-model="form.priority" clearable placeholder="请选择优先级">
<el-form-item :label="$t('test_track.priority')" :label-width="formLabelWidth" prop="priority">
<el-select v-model="form.priority" clearable :placeholder="$t('test_track.input_priority')">
<el-option label="P0" value="P0"></el-option>
<el-option label="P1" value="P1"></el-option>
<el-option label="P2" value="P2"></el-option>
@ -61,26 +61,26 @@
<el-row>
<el-col :span="10" :offset="1">
<el-form-item label="用例类型" :label-width="formLabelWidth" prop="type">
<el-select v-model="form.type" placeholder="请选择用例类型">
<el-option label="功能测试" value="functional"></el-option>
<el-option label="性能测试" value="performance"></el-option>
<el-option label="接口测试" value="interface"></el-option>
<el-form-item :label="$t('test_track.type')" :label-width="formLabelWidth" prop="type">
<el-select v-model="form.type" :placeholder="$t('test_track.input_type')">
<el-option :label="$t('commons.functional')" value="functional"></el-option>
<el-option :label="$t('commons.performance')" value="performance"></el-option>
<el-option :label="$t('commons.interface')" value="interface"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="测试方式" :label-width="formLabelWidth" prop="method">
<el-select v-model="form.method" placeholder="请选择测试方式">
<el-option label="手动" value="manual"></el-option>
<el-option label="自动" value="auto"></el-option>
<el-form-item :label="$t('test_track.method')" :label-width="formLabelWidth" prop="method">
<el-select v-model="form.method" :placeholder="$t('test_track.input_method')">
<el-option :label="$t('test_track.manual')" value="manual"></el-option>
<el-option :label="$t('test_track.auto')" value="auto"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row style="margin-top: 15px;">
<el-col :offset="2">前置条件:</el-col>
<el-col :offset="2">{{$t('test_track.prerequisite')}}:</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin-top: 10px;">
<el-col :span="20">
@ -89,13 +89,13 @@
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:rows="2"
placeholder="请输入前置条件"></el-input>
:placeholder="$t('test_track.input_prerequisite')"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row style="margin-bottom: 10px">
<el-col :offset="2">执行步骤:</el-col>
<el-col :offset="2">{{$t('test_track.steps')}}:</el-col>
</el-row>
<el-row type="flex" justify="center">
<el-col :span="20">
@ -105,28 +105,28 @@
border
:default-sort = "{prop: 'num', order: 'ascending'}"
highlight-current-row>
<el-table-column label="编号" prop="num" min-width="15%"></el-table-column>
<el-table-column label="步骤描述" prop="desc" min-width="35%">
<el-table-column :label="$t('test_track.number')" prop="num" min-width="15%"></el-table-column>
<el-table-column :label="$t('test_track.step_desc')" prop="desc" min-width="35%">
<template slot-scope="scope">
<el-input
size="small"
v-model="scope.row.desc"
placeholder="请输入内容"
:placeholder="$t('commons.input_content')"
clearable></el-input>
<span>{{scope.row.desc}}</span>
</template>
</el-table-column>
<el-table-column label="预期结果" prop="result" min-width="35%">
<el-table-column :label="$t('test_track.expected_results')" prop="result" min-width="35%">
<template slot-scope="scope">
<el-input
size="small"
v-model="scope.row.result"
placeholder="请输入内容"
:placeholder="$t('commons.input_content')"
clearable></el-input>
<span>{{scope.row.result}}</span>
</template>
</el-table-column>
<el-table-column label="操作" min-width="15%">
<el-table-column :label="$t('commons.input_content')" min-width="15%">
<template slot-scope="scope">
<el-button
type="primary"
@ -146,7 +146,7 @@
</el-row>
<el-row style="margin-top: 15px;margin-bottom: 10px">
<el-col :offset="2">备注:</el-col>
<el-col :offset="2">{{$t('commons.remark')}}:</el-col>
</el-row>
<el-row type="flex" justify="center">
<el-col :span="20">
@ -155,7 +155,7 @@
:autosize="{ minRows: 2, maxRows: 4}"
type="textarea"
:rows="2"
placeholder="请输入内容"></el-input>
:placeholder="$t('commons.input_content')"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -164,12 +164,12 @@
<div slot="footer" class="dialog-footer">
<el-button
@click="dialogFormVisible = false">
{{$t('test_track.cancel')}}
</el-button>
<el-button
type="primary"
@click="saveCase">
{{$t('test_track.confirm')}}
</el-button>
</div>
</el-dialog>
@ -203,12 +203,12 @@
moduleOptions: [],
maintainerOptions: [],
rules:{
name :[{required: true, message: '请输入用例名称', trigger: 'blur'}],
module :[{required: true, message: '请选择模块', trigger: 'change'}],
maintainer :[{required: true, message: '请选择维护人', trigger: 'change'}],
priority :[{required: true, message: '请选择优先级', trigger: 'change'}],
type :[{required: true, message: '请选择用例类型', trigger: 'change'}],
method :[{required: true, message: '请选择测试方式', trigger: 'change'}]
name :[{required: true, message: this.$t('test_track.input_name'), trigger: 'blur'}],
module :[{required: true, message: this.$t('test_track.input_module'), trigger: 'change'}],
maintainer :[{required: true, message: this.$t('test_track.input_maintainer'), trigger: 'change'}],
priority :[{required: true, message: this.$t('test_track.input_priority'), trigger: 'change'}],
type :[{required: true, message: this.$t('test_track.input_type'), trigger: 'change'}],
method :[{required: true, message: this.$t('test_track.input_method'), trigger: 'change'}]
},
formLabelWidth: "120px",
operationType: ''
@ -261,7 +261,7 @@
param.nodeId = this.form.module;
param.projectId = this.projectId;
this.$post('/test/case/' + this.operationType, param, () => {
this.$message.success("保存成功!");
this.$message.success(this.$t('commons.save_success'));
this.resetForm();
this.dialogFormVisible = false;
this.$emit("refresh");

View File

@ -10,13 +10,13 @@
<el-col :span="1" :offset="8">
<el-button icon="el-icon-circle-plus-outline" size="small" round
@click="opentestCaseEditDialog" >新建</el-button>
@click="$emit('opentestCaseEditDialog')" >{{$t('commons.create')}}</el-button>
</el-col>
<el-col :span="1" >
<el-button
icon="el-icon-refresh" size="small" round
@click="initTableData(null)">刷新</el-button>
@click="initTableData(null)">{{$t('commons.refresh')}}</el-button>
</el-col>
<el-col :span="5">
@ -41,34 +41,34 @@
</el-table-column>
<el-table-column
prop="priority"
label="优先级"
:label="$t('test_track.priority')"
width="130"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="type"
label="类型"
:label="$t('test_track.type')"
width="130"
show-overflow-tooltip>
<template slot-scope="scope">
<span v-if="scope.row.type == 'functional'">功能测试</span>
<span v-if="scope.row.type == 'performance'">性能测试</span>
<span v-if="scope.row.type == 'interface'">接口测试</span>
<span v-if="scope.row.type == 'functional'">{{$t('commons.functional')}}</span>
<span v-if="scope.row.type == 'performance'">{{$t('commons.performance')}}</span>
<span v-if="scope.row.type == 'interface'">{{$t('commons.interface')}}</span>
</template>
</el-table-column>
<el-table-column
prop="method"
label="测试方式"
:label="$t('test_track.method')"
width="130"
show-overflow-tooltip>
<template slot-scope="scope">
<span v-if="scope.row.method == 'manual'">手动</span>
<span v-if="scope.row.method == 'auto'">自动</span>
<span v-if="scope.row.method == 'manual'">{{$t('test_track.manual')}}</span>
<span v-if="scope.row.method == 'auto'">{{$t('test_track.auto')}}</span>
</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
:label="$t('commons.remark')"
width="160"
show-overflow-tooltip>
</el-table-column>
@ -193,9 +193,6 @@
type: 'success'
});
});
},
opentestCaseEditDialog() {
this.$emit('opentestCaseEditDialog');
}
}
}

View File

@ -40,6 +40,12 @@ export default {
'system_setting': 'Settings',
'functional': 'Functional',
'performance': 'Performance',
'interface': 'Interface test',
'input_content': 'Please enter content',
'create': 'create',
'refresh': 'refresh',
'remark': 'remark',
'delete': 'delete',
},
workspace: {
'create': 'Create Workspace',
@ -171,6 +177,35 @@ export default {
'create_case': 'Create Case',
'test_plan': 'Test Plan',
'create_plan': 'Create Plan',
'no_project': 'There is no project in this workspace, please create the project first',
'priority': 'Priority',
'type': 'Type',
'method': 'The test way',
'auto': 'Auto',
'manual': 'Manual',
'create': 'Create test case',
'name': 'Test case name',
'module': 'Subordinate to the module',
'maintainer': 'Maintainer',
'steps': 'Steps',
'number': 'Number',
'prerequisite': 'Prerequisite',
'step_desc': 'Step describe',
'expected_results': 'Expected results',
'confirm': 'confirm',
'cancel': 'cancel',
'input_name': 'Please enter name',
'input_module': 'Please select module',
'input_maintainer': 'Please select maintainer',
'input_priority': 'Please select priority',
'input_type': 'Please select type',
'input_method': 'Please select method',
'input_prerequisite': 'Please select prerequisite',
'search_module': 'Search module',
'rename': 'rename',
'add_submodule': 'Add submodule',
'add_module': 'Add module',
'module_name': 'Module name'
},
i18n: {
'home': 'Home'

View File

@ -40,6 +40,12 @@ export default {
'system_setting': '系统设置',
'functional': '功能测试',
'performance': '性能测试',
'interface': '接口测试',
'input_content': '请输入内容',
'create': '新建',
'refresh': '刷新',
'remark': '备注',
'delete': '删除'
},
workspace: {
'create': '创建工作空间',
@ -171,8 +177,37 @@ export default {
'create_case': '创建用例',
'test_plan': '测试计划',
'create_plan': '创建计划',
'no_project': '该工作空间下无项目,请先创建项目',
'priority': '优先级',
'type': '类型',
'method': '测试方式',
'auto': '自动',
'manual': '手动',
'create': '新建用例',
'name': '用例名称',
'module': '所属模块',
'maintainer': '维护人',
'steps': '执行步骤',
'number': '编号',
'prerequisite': '前置条件',
'step_desc': '步骤描述',
'expected_results': '预期结果',
'confirm': '确 定',
'cancel': '取 消',
'input_name': '请输入名称',
'input_module': '请选择模块',
'input_maintainer': '请选择维护人',
'input_priority': '请选择优先级',
'input_type': '请选择用例类型',
'input_method': '请选择测试方式',
'input_prerequisite': '请输入前置条件',
'search_module': '搜索模块',
'rename': '重命名',
'add_submodule': '添加子模块',
'add_module': '添加模块',
'module_name': '模块名称'
},
i18n: {
'home': '首页',
'home': '首页'
}
};