fix(测试跟踪): 修复用例关联全部问题
This commit is contained in:
parent
e0a349e432
commit
ce90cf9cb5
|
@ -83,6 +83,9 @@ public class XmindCaseParser {
|
|||
|
||||
private final Map<String, String> caseTypeMap = ImmutableMap.of("功能测试", "functional", "性能测试", "performance", "接口测试", "api");
|
||||
|
||||
/**
|
||||
* 验证模块的合规性
|
||||
*/
|
||||
public void validate() {
|
||||
nodePaths.forEach(nodePath -> {
|
||||
String[] nodes = nodePath.split("/");
|
||||
|
@ -90,9 +93,11 @@ public class XmindCaseParser {
|
|||
process.append(Translator.get("test_case_node_level_tip") +
|
||||
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
|
||||
}
|
||||
String path = "";
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
path += nodes[i].trim() + "/";
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
|
||||
process.append(Translator.get("module_not_null") + "; ");
|
||||
process.append(path + ":" + Translator.get("module_not_null") + "; ");
|
||||
} else if (nodes[i].trim().length() > 30) {
|
||||
process.append(nodes[i].trim() + ":" + Translator.get("test_track.length_less_than") + "30 ;");
|
||||
}
|
||||
|
@ -100,12 +105,61 @@ public class XmindCaseParser {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证用例的合规性
|
||||
*/
|
||||
private boolean validate(TestCaseWithBLOBs data) {
|
||||
String nodePath = data.getNodePath();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
if (data.getName().length() > 50) {
|
||||
stringBuilder.append(data.getName() + ":" + Translator.get("test_case") + Translator.get("test_track.length_less_than") + "50 ;");
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(nodePath)) {
|
||||
String[] nodes = nodePath.split("/");
|
||||
if (nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) {
|
||||
stringBuilder.append(Translator.get("test_case_node_level_tip") +
|
||||
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
|
||||
}
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
|
||||
stringBuilder.append(Translator.get("test_case") + "," + data.getName() + Translator.get("module_not_null") + "; ");
|
||||
break;
|
||||
} else if (nodes[i].trim().length() > 30) {
|
||||
stringBuilder.append(nodes[i].trim() + ":" + Translator.get("module") + Translator.get("test_track.length_less_than") + "30 ;");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
|
||||
stringBuilder.append(Translator.get("functional_method_tip") + "; ");
|
||||
}
|
||||
|
||||
if (testCaseNames.contains(data.getName())) {
|
||||
boolean dbExist = testCaseService.exist(data);
|
||||
if (dbExist) {
|
||||
// db exist
|
||||
stringBuilder.append(Translator.get("test_case_already_exists_excel") + ":" + data.getName() + "; ");
|
||||
}
|
||||
|
||||
} else {
|
||||
testCaseNames.add(data.getName());
|
||||
}
|
||||
if (!StringUtils.isEmpty(stringBuilder.toString())) {
|
||||
process.append(stringBuilder.toString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归处理案例数据
|
||||
*/
|
||||
private void recursion(Attached parent, int level, List<Attached> attacheds) {
|
||||
for (Attached item : attacheds) {
|
||||
if (isAvailable(item.getTitle(), TC_REGEX)) { // 用例
|
||||
if (isAvailable(item.getTitle(), TC_REGEX)) {
|
||||
item.setParent(parent);
|
||||
this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
|
||||
} else {
|
||||
|
@ -121,7 +175,8 @@ public class XmindCaseParser {
|
|||
if (nodePath.endsWith("/")) {
|
||||
nodePath = nodePath.substring(0, nodePath.length() - 1);
|
||||
}
|
||||
nodePaths.add(nodePath); // 没有用例的路径
|
||||
// 没有用例的路径
|
||||
nodePaths.add(nodePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -241,55 +296,6 @@ public class XmindCaseParser {
|
|||
compartDatas.add(compartData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证合法性
|
||||
*/
|
||||
private boolean validate(TestCaseWithBLOBs data) {
|
||||
String nodePath = data.getNodePath();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
if (data.getName().length() > 50) {
|
||||
stringBuilder.append(data.getName() + ":" + Translator.get("test_case") + Translator.get("test_track.length_less_than") + "50 ;");
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(nodePath)) {
|
||||
String[] nodes = nodePath.split("/");
|
||||
if (nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) {
|
||||
stringBuilder.append(Translator.get("test_case_node_level_tip") +
|
||||
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
|
||||
}
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) {
|
||||
stringBuilder.append(Translator.get("module_not_null") + "; ");
|
||||
break;
|
||||
} else if (nodes[i].trim().length() > 30) {
|
||||
stringBuilder.append(nodes[i].trim() + ":" + Translator.get("module") + Translator.get("test_track.length_less_than") + "30 ;");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
|
||||
stringBuilder.append(Translator.get("functional_method_tip") + "; ");
|
||||
}
|
||||
|
||||
if (testCaseNames.contains(data.getName())) {
|
||||
boolean dbExist = testCaseService.exist(data);
|
||||
if (dbExist) {
|
||||
// db exist
|
||||
stringBuilder.append(Translator.get("test_case_already_exists_excel") + ":" + data.getName() + "; ");
|
||||
}
|
||||
|
||||
} else {
|
||||
testCaseNames.add(data.getName());
|
||||
}
|
||||
if (!StringUtils.isEmpty(stringBuilder.toString())) {
|
||||
process.append(stringBuilder.toString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入思维导图处理
|
||||
*/
|
||||
|
@ -323,8 +329,8 @@ public class XmindCaseParser {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.validate(); //检查目录合规性
|
||||
//检查目录合规性
|
||||
this.validate();
|
||||
} catch (Exception ex) {
|
||||
return ex.getMessage();
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<template>
|
||||
|
||||
<div>
|
||||
|
||||
<el-dialog :title="$t('test_track.plan_view.relevance_test_case')"
|
||||
:visible.sync="dialogFormVisible"
|
||||
@close="close"
|
||||
|
@ -29,7 +27,7 @@
|
|||
@filter-change="filter"
|
||||
row-key="id"
|
||||
@mouseleave.passive="leave"
|
||||
v-el-table-infinite-scroll="loadData"
|
||||
v-el-table-infinite-scroll="scrollLoading"
|
||||
@select-all="handleSelectAll"
|
||||
@select="handleSelectionChange"
|
||||
height="50vh"
|
||||
|
@ -196,9 +194,9 @@
|
|||
search() {
|
||||
this.currentPage = 1;
|
||||
this.testCases = [];
|
||||
this.getTestCases();
|
||||
this.getTestCases(true);
|
||||
},
|
||||
getTestCases() {
|
||||
getTestCases(flag) {
|
||||
if (this.planId) {
|
||||
this.condition.planId = this.planId;
|
||||
}
|
||||
|
@ -216,7 +214,7 @@
|
|||
tableData.forEach(item => {
|
||||
item.checked = false;
|
||||
});
|
||||
this.testCases = this.testCases.concat(tableData);
|
||||
flag ? this.testCases = tableData : this.testCases = this.testCases.concat(tableData);
|
||||
this.lineStatus = tableData.length === 50 && this.testCases.length < this.total;
|
||||
});
|
||||
}
|
||||
|
@ -249,12 +247,10 @@
|
|||
refresh() {
|
||||
this.close();
|
||||
},
|
||||
loadData() {
|
||||
if (this.dialogFormVisible) {
|
||||
if (this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getTestCases();
|
||||
}
|
||||
scrollLoading() {
|
||||
if (this.dialogFormVisible && this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getTestCases();
|
||||
}
|
||||
},
|
||||
getAllNodeTreeByPlanId() {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<template>
|
||||
|
||||
<div>
|
||||
|
||||
<el-dialog :title="$t('test_track.review_view.relevance_case')" :visible.sync="dialogFormVisible" @close="close"
|
||||
width="60%" v-loading="result.loading"
|
||||
:close-on-click-modal="false"
|
||||
|
@ -19,7 +17,7 @@
|
|||
<el-container>
|
||||
<el-main class="case-content">
|
||||
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/>
|
||||
<el-table :data="testReviews" @mouseleave.passive="leave" v-el-table-infinite-scroll="loadData"
|
||||
<el-table :data="testReviews" @mouseleave.passive="leave" v-el-table-infinite-scroll="scrollLoading"
|
||||
@filter-change="filter" row-key="id"
|
||||
@select-all="handleSelectAll"
|
||||
@select="handleSelectionChange"
|
||||
|
@ -202,7 +200,7 @@
|
|||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
getReviews() {
|
||||
getReviews(flag) {
|
||||
if (this.reviewId) {
|
||||
this.condition.reviewId = this.reviewId;
|
||||
}
|
||||
|
@ -220,7 +218,7 @@
|
|||
tableData.forEach(item => {
|
||||
item.checked = false;
|
||||
});
|
||||
this.testReviews = this.testReviews.concat(tableData);
|
||||
flag ? this.testReviews = tableData : this.testReviews = this.testReviews.concat(tableData);
|
||||
this.lineStatus = tableData.length === 50 && this.testReviews.length < this.total;
|
||||
|
||||
});
|
||||
|
@ -301,18 +299,16 @@
|
|||
switchProject() {
|
||||
this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'});
|
||||
},
|
||||
loadData() {
|
||||
if (this.dialogFormVisible) {
|
||||
if (this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getReviews();
|
||||
}
|
||||
scrollLoading() {
|
||||
if (this.dialogFormVisible && this.lineStatus) {
|
||||
this.currentPage += 1;
|
||||
this.getReviews();
|
||||
}
|
||||
},
|
||||
search() {
|
||||
this.currentPage = 1;
|
||||
this.testReviews = [];
|
||||
this.getReviews();
|
||||
this.getReviews(true);
|
||||
},
|
||||
|
||||
getProjectNode(projectId) {
|
||||
|
|
Loading…
Reference in New Issue