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();
String[] stepDesc = new String[0];
String[] stepRes = new String[0];
String[] stepDesc = new String[1];
String[] stepRes = new String[1];
if (data.getStepDesc() != null) {
stepDesc = data.getStepDesc().split("\n");
} else {
stepDesc[0] = "";
}
if (data.getStepResult() != null) {
stepRes = data.getStepResult().split("\n");
} else {
stepRes[0] = "";
}
String pattern = "(^\\d+)(\\.)?";

View File

@ -13,7 +13,7 @@
:label="$t('test_track.case.name')"
:label-width="formLabelWidth"
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-col>

View File

@ -2,8 +2,6 @@
<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"
@close="init">
@ -41,7 +39,6 @@
</el-dialog>
</div>
</template>
@ -67,7 +64,6 @@
},
methods: {
handlePreview(file) {
console.log("init");
this.init();
},
handleExceed(files, fileList) {
@ -109,6 +105,9 @@
init() {
this.fileList = [];
this.errList = [];
},
open() {
this.dialogVisible = true;
}
}
}

View File

@ -10,17 +10,25 @@
<node-breadcrumb class="table-title" :node-names="selectNodeNames" @refresh="refresh"/>
</template>
<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/>-->
</template>
</ms-table-header>
</template>
<test-case-import :projectId="currentProject == null? null : currentProject.id" @refresh="refresh" ref="testCaseImport"/>
<el-table
:data="tableData"
@select-all="handleSelectAll"
@select="handleSelectionChange"
@row-click="showDetail"
row-key="id"
class="test-content">
<el-table-column
type="selection"/>
<el-table-column
prop="name"
:label="$t('commons.name')"
@ -103,10 +111,12 @@
import MethodTableItem from "../../common/tableItems/planview/MethodTableItem";
import MsTableOperator from "../../../common/components/MsTableOperator";
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
import MsTableButton from "../../../common/components/MsTableButton";
export default {
name: "TestCaseList",
components: {
MsTableButton,
MsTableOperatorButton,
MsTableOperator,
MethodTableItem,
@ -120,8 +130,9 @@
condition: {},
tableData: [],
currentPage: 1,
pageSize: 5,
pageSize: 10,
total: 0,
selectIds: new Set(),
priorityFilters: [
{text: 'P0', value: 'P0'},
{text: 'P1', value: 'P1'},
@ -169,6 +180,7 @@
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
this.selectIds.clear();
});
}
},
@ -209,6 +221,7 @@
},
refresh() {
this.condition = {};
this.selectIds.clear();
this.$emit('refresh');
},
filter(value, row, column) {
@ -217,6 +230,25 @@
},
showDetail(row, event, column) {
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>
<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"
:before-close="close"
width="30%">
<el-row type="flex" justify="center">
<el-col :span="18">
<el-form :model="form" :rules="rules">
<el-form :model="form" :rules="rules" ref="nodeForm">
<el-form-item
:label="$t('test_track.module.name')"
:label-width="formLabelWidth"
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>
</el-col>
@ -19,7 +20,7 @@
<template v-slot:footer>
<ms-dialog-footer
@cancel="dialogFormVisible = false"
@cancel="close"
@confirm="saveNode"/>
</template>
@ -59,12 +60,18 @@
this.dialogFormVisible = true;
},
saveNode() {
let param = {};
let url = this.buildParam(param);
this.$post(url, param, () => {
this.$message.success(this.$t('commons.save_success'));
this.$emit('refresh');
this.close();
this.$refs['nodeForm'].validate((valid) => {
if (valid) {
let param = {};
let url = this.buildParam(param);
this.$post(url, param, () => {
this.$message.success(this.$t('commons.save_success'));
this.$emit('refresh');
this.close();
});
} else {
return false;
}
});
},
buildParam(param, ) {

View File

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

View File

@ -1,8 +1,8 @@
<template>
<div>
<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 == 'P2'" type="warning" :content="value"/>
<ms-tag v-if="value == 'P1'" 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"/>
</div>

View File

@ -2,7 +2,7 @@
<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"
width="65%">
@ -15,7 +15,7 @@
:label="$t('test_track.plan.plan_name')"
:label-width="formLabelWidth"
prop="name">
<el-input v-model="form.name"></el-input>
<el-input v-model.trim="form.name"></el-input>
</el-form-item>
</el-col>

View File

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

View File

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

View File

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