fix 测试用例

This commit is contained in:
chenjianxing 2020-04-26 14:25:22 +08:00
parent 1556173241
commit bc518448a6
11 changed files with 70 additions and 27 deletions

View File

@ -91,14 +91,18 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
String[] stepDesc = new String[0]; String[] stepDesc = new String[1];
String[] stepRes = new String[0]; String[] stepRes = new String[1];
if (data.getStepDesc() != null) { if (data.getStepDesc() != null) {
stepDesc = data.getStepDesc().split("\n"); stepDesc = data.getStepDesc().split("\n");
} else {
stepDesc[0] = "";
} }
if (data.getStepResult() != null) { if (data.getStepResult() != null) {
stepRes = data.getStepResult().split("\n"); stepRes = data.getStepResult().split("\n");
} else {
stepRes[0] = "";
} }
String pattern = "(^\\d+)(\\.)?"; String pattern = "(^\\d+)(\\.)?";

View File

@ -13,7 +13,7 @@
:label="$t('test_track.case.name')" :label="$t('test_track.case.name')"
:label-width="formLabelWidth" :label-width="formLabelWidth"
prop="name"> prop="name">
<el-input :disabled="readOnly" v-model="form.name"></el-input> <el-input :disabled="readOnly" v-model.trim="form.name"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>

View File

@ -2,8 +2,6 @@
<div> <div>
<ms-table-button icon="el-icon-upload2" :content="$t('test_track.case.import.import')" @click="dialogVisible = true"/>
<el-dialog width="30%" :title="$t('test_track.case.import.case_import')" :visible.sync="dialogVisible" <el-dialog width="30%" :title="$t('test_track.case.import.case_import')" :visible.sync="dialogVisible"
@close="init"> @close="init">
@ -41,7 +39,6 @@
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -67,7 +64,6 @@
}, },
methods: { methods: {
handlePreview(file) { handlePreview(file) {
console.log("init");
this.init(); this.init();
}, },
handleExceed(files, fileList) { handleExceed(files, fileList) {
@ -109,6 +105,9 @@
init() { init() {
this.fileList = []; this.fileList = [];
this.errList = []; this.errList = [];
},
open() {
this.dialogVisible = true;
} }
} }
} }

View File

@ -10,17 +10,25 @@
<node-breadcrumb class="table-title" :node-names="selectNodeNames" @refresh="refresh"/> <node-breadcrumb class="table-title" :node-names="selectNodeNames" @refresh="refresh"/>
</template> </template>
<template v-slot:button> <template v-slot:button>
<test-case-import :projectId="currentProject == null? null : currentProject.id" @refresh="refresh"/> <ms-table-button icon="el-icon-upload2" :content="$t('test_track.case.import.import')" @click="importTestCase"/>
<!--<ms-table-button icon="el-icon-right" :content="$t('test_track.case.import.import')" @click="dialogVisible = true"/>-->
<!--<test-case-export/>--> <!--<test-case-export/>-->
</template> </template>
</ms-table-header> </ms-table-header>
</template> </template>
<test-case-import :projectId="currentProject == null? null : currentProject.id" @refresh="refresh" ref="testCaseImport"/>
<el-table <el-table
:data="tableData" :data="tableData"
@select-all="handleSelectAll"
@select="handleSelectionChange"
@row-click="showDetail" @row-click="showDetail"
row-key="id"
class="test-content"> class="test-content">
<el-table-column
type="selection"/>
<el-table-column <el-table-column
prop="name" prop="name"
:label="$t('commons.name')" :label="$t('commons.name')"
@ -103,10 +111,12 @@
import MethodTableItem from "../../common/tableItems/planview/MethodTableItem"; import MethodTableItem from "../../common/tableItems/planview/MethodTableItem";
import MsTableOperator from "../../../common/components/MsTableOperator"; import MsTableOperator from "../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton"; import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
import MsTableButton from "../../../common/components/MsTableButton";
export default { export default {
name: "TestCaseList", name: "TestCaseList",
components: { components: {
MsTableButton,
MsTableOperatorButton, MsTableOperatorButton,
MsTableOperator, MsTableOperator,
MethodTableItem, MethodTableItem,
@ -120,8 +130,9 @@
condition: {}, condition: {},
tableData: [], tableData: [],
currentPage: 1, currentPage: 1,
pageSize: 5, pageSize: 10,
total: 0, total: 0,
selectIds: new Set(),
priorityFilters: [ priorityFilters: [
{text: 'P0', value: 'P0'}, {text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'}, {text: 'P1', value: 'P1'},
@ -169,6 +180,7 @@
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
this.tableData = data.listObject; this.tableData = data.listObject;
this.selectIds.clear();
}); });
} }
}, },
@ -209,6 +221,7 @@
}, },
refresh() { refresh() {
this.condition = {}; this.condition = {};
this.selectIds.clear();
this.$emit('refresh'); this.$emit('refresh');
}, },
filter(value, row, column) { filter(value, row, column) {
@ -217,6 +230,25 @@
}, },
showDetail(row, event, column) { showDetail(row, event, column) {
this.$emit('testCaseDetail', row); this.$emit('testCaseDetail', row);
},
handleSelectAll(selection) {
if(selection.length > 0) {
this.tableData.forEach(item => {
this.selectIds.add(item.id);
});
} else {
this.selectIds.clear();
}
},
handleSelectionChange(selection, row) {
if(this.selectIds.has(row.id)){
this.selectIds.delete(row.id);
} else {
this.selectIds.add(row.id);
}
},
importTestCase() {
this.$refs.testCaseImport.open();
} }
} }
} }

View File

@ -1,17 +1,18 @@
<template> <template>
<el-dialog :title="$t('test_track.module.add_module')" <el-dialog :title="type == 'edit' ? $t('test_track.module.rename') : $t('test_track.module.add_module')"
:visible.sync="dialogFormVisible" :visible.sync="dialogFormVisible"
:before-close="close"
width="30%"> width="30%">
<el-row type="flex" justify="center"> <el-row type="flex" justify="center">
<el-col :span="18"> <el-col :span="18">
<el-form :model="form" :rules="rules"> <el-form :model="form" :rules="rules" ref="nodeForm">
<el-form-item <el-form-item
:label="$t('test_track.module.name')" :label="$t('test_track.module.name')"
:label-width="formLabelWidth" :label-width="formLabelWidth"
prop="name"> prop="name">
<el-input v-model="form.name" autocomplete="off"></el-input> <el-input v-model.trim="form.name" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
@ -19,7 +20,7 @@
<template v-slot:footer> <template v-slot:footer>
<ms-dialog-footer <ms-dialog-footer
@cancel="dialogFormVisible = false" @cancel="close"
@confirm="saveNode"/> @confirm="saveNode"/>
</template> </template>
@ -59,12 +60,18 @@
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
saveNode() { saveNode() {
let param = {}; this.$refs['nodeForm'].validate((valid) => {
let url = this.buildParam(param); if (valid) {
this.$post(url, param, () => { let param = {};
this.$message.success(this.$t('commons.save_success')); let url = this.buildParam(param);
this.$emit('refresh'); this.$post(url, param, () => {
this.close(); this.$message.success(this.$t('commons.save_success'));
this.$emit('refresh');
this.close();
});
} else {
return false;
}
}); });
}, },
buildParam(param, ) { buildParam(param, ) {

View File

@ -44,9 +44,6 @@
</span> </span>
<!--<span v-if="type == 'view'" class="custom-tree-node" @click="selectNode(node)">-->
<!--{{node.label}}$$-->
<!--</span>-->
</template> </template>
</el-tree> </el-tree>

View File

@ -1,8 +1,8 @@
<template> <template>
<div> <div>
<ms-tag v-if="value == 'P0'" type="danger" :content="value"/> <ms-tag v-if="value == 'P0'" type="danger" :content="value"/>
<ms-tag v-if="value == 'P1'" effect="light" type="danger" :content="value"/> <ms-tag v-if="value == 'P1'" type="warning" :content="value"/>
<ms-tag v-if="value == 'P2'" type="warning" :content="value"/> <ms-tag v-if="value == 'P2'" effect="light" type="danger" :content="value"/>
<ms-tag v-if="value == 'P3'" effect="light" type="warning" :content="value"/> <ms-tag v-if="value == 'P3'" effect="light" type="warning" :content="value"/>
</div> </div>

View File

@ -2,7 +2,7 @@
<div> <div>
<el-dialog :title="$t('test_track.plan.create_plan')" <el-dialog :title="operationType == 'edit' ? $t('test_track.plan.edit_plan') : $t('test_track.plan.create_plan')"
:visible.sync="dialogFormVisible" :visible.sync="dialogFormVisible"
width="65%"> width="65%">
@ -15,7 +15,7 @@
:label="$t('test_track.plan.plan_name')" :label="$t('test_track.plan.plan_name')"
:label-width="formLabelWidth" :label-width="formLabelWidth"
prop="name"> prop="name">
<el-input v-model="form.name"></el-input> <el-input v-model.trim="form.name"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>

View File

@ -141,7 +141,7 @@
showMyTestCase: false, showMyTestCase: false,
tableData: [], tableData: [],
currentPage: 1, currentPage: 1,
pageSize: 5, pageSize: 10,
total: 0, total: 0,
selectIds: new Set(), selectIds: new Set(),
priorityFilters: [ priorityFilters: [
@ -198,11 +198,13 @@
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
this.tableData = data.listObject; this.tableData = data.listObject;
this.selectIds.clear();
}); });
} }
}, },
refresh() { refresh() {
this.condition = {}; this.condition = {};
this.selectIds.clear();
this.$emit('refresh'); this.$emit('refresh');
}, },
search() { search() {

View File

@ -233,6 +233,7 @@ export default {
plan: { plan: {
test_plan: "Test Plan", test_plan: "Test Plan",
create_plan: "Create test plan", create_plan: "Create test plan",
edit_plan: "Edit test plan",
plan_name: "Test plan name", plan_name: "Test plan name",
plan_project: "Related project", plan_project: "Related project",
plan_stage: "Testing phase", plan_stage: "Testing phase",

View File

@ -276,6 +276,7 @@ export default {
plan: { plan: {
test_plan: "测试计划", test_plan: "测试计划",
create_plan: "创建测试计划", create_plan: "创建测试计划",
edit_plan: "编辑测试计划",
plan_name: "计划名称", plan_name: "计划名称",
plan_project: "所属项目", plan_project: "所属项目",
plan_stage: "测试阶段", plan_stage: "测试阶段",