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");
|
private final Map<String, String> caseTypeMap = ImmutableMap.of("功能测试", "functional", "性能测试", "performance", "接口测试", "api");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证模块的合规性
|
||||||
|
*/
|
||||||
public void validate() {
|
public void validate() {
|
||||||
nodePaths.forEach(nodePath -> {
|
nodePaths.forEach(nodePath -> {
|
||||||
String[] nodes = nodePath.split("/");
|
String[] nodes = nodePath.split("/");
|
||||||
|
@ -90,9 +93,11 @@ public class XmindCaseParser {
|
||||||
process.append(Translator.get("test_case_node_level_tip") +
|
process.append(Translator.get("test_case_node_level_tip") +
|
||||||
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
|
TestCaseConstants.MAX_NODE_DEPTH + Translator.get("test_case_node_level") + "; ");
|
||||||
}
|
}
|
||||||
|
String path = "";
|
||||||
for (int i = 0; i < nodes.length; i++) {
|
for (int i = 0; i < nodes.length; i++) {
|
||||||
|
path += nodes[i].trim() + "/";
|
||||||
if (i != 0 && StringUtils.equals(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) {
|
} else if (nodes[i].trim().length() > 30) {
|
||||||
process.append(nodes[i].trim() + ":" + Translator.get("test_track.length_less_than") + "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) {
|
private void recursion(Attached parent, int level, List<Attached> attacheds) {
|
||||||
for (Attached item : attacheds) {
|
for (Attached item : attacheds) {
|
||||||
if (isAvailable(item.getTitle(), TC_REGEX)) { // 用例
|
if (isAvailable(item.getTitle(), TC_REGEX)) {
|
||||||
item.setParent(parent);
|
item.setParent(parent);
|
||||||
this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
|
this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,7 +175,8 @@ public class XmindCaseParser {
|
||||||
if (nodePath.endsWith("/")) {
|
if (nodePath.endsWith("/")) {
|
||||||
nodePath = nodePath.substring(0, nodePath.length() - 1);
|
nodePath = nodePath.substring(0, nodePath.length() - 1);
|
||||||
}
|
}
|
||||||
nodePaths.add(nodePath); // 没有用例的路径
|
// 没有用例的路径
|
||||||
|
nodePaths.add(nodePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,55 +296,6 @@ public class XmindCaseParser {
|
||||||
compartDatas.add(compartData);
|
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) {
|
} catch (Exception ex) {
|
||||||
return ex.getMessage();
|
return ex.getMessage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<el-dialog :title="$t('test_track.plan_view.relevance_test_case')"
|
<el-dialog :title="$t('test_track.plan_view.relevance_test_case')"
|
||||||
:visible.sync="dialogFormVisible"
|
:visible.sync="dialogFormVisible"
|
||||||
@close="close"
|
@close="close"
|
||||||
|
@ -29,7 +27,7 @@
|
||||||
@filter-change="filter"
|
@filter-change="filter"
|
||||||
row-key="id"
|
row-key="id"
|
||||||
@mouseleave.passive="leave"
|
@mouseleave.passive="leave"
|
||||||
v-el-table-infinite-scroll="loadData"
|
v-el-table-infinite-scroll="scrollLoading"
|
||||||
@select-all="handleSelectAll"
|
@select-all="handleSelectAll"
|
||||||
@select="handleSelectionChange"
|
@select="handleSelectionChange"
|
||||||
height="50vh"
|
height="50vh"
|
||||||
|
@ -196,9 +194,9 @@
|
||||||
search() {
|
search() {
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
this.testCases = [];
|
this.testCases = [];
|
||||||
this.getTestCases();
|
this.getTestCases(true);
|
||||||
},
|
},
|
||||||
getTestCases() {
|
getTestCases(flag) {
|
||||||
if (this.planId) {
|
if (this.planId) {
|
||||||
this.condition.planId = this.planId;
|
this.condition.planId = this.planId;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +214,7 @@
|
||||||
tableData.forEach(item => {
|
tableData.forEach(item => {
|
||||||
item.checked = false;
|
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;
|
this.lineStatus = tableData.length === 50 && this.testCases.length < this.total;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -249,12 +247,10 @@
|
||||||
refresh() {
|
refresh() {
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
loadData() {
|
scrollLoading() {
|
||||||
if (this.dialogFormVisible) {
|
if (this.dialogFormVisible && this.lineStatus) {
|
||||||
if (this.lineStatus) {
|
this.currentPage += 1;
|
||||||
this.currentPage += 1;
|
this.getTestCases();
|
||||||
this.getTestCases();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getAllNodeTreeByPlanId() {
|
getAllNodeTreeByPlanId() {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<el-dialog :title="$t('test_track.review_view.relevance_case')" :visible.sync="dialogFormVisible" @close="close"
|
<el-dialog :title="$t('test_track.review_view.relevance_case')" :visible.sync="dialogFormVisible" @close="close"
|
||||||
width="60%" v-loading="result.loading"
|
width="60%" v-loading="result.loading"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
|
@ -19,7 +17,7 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-main class="case-content">
|
<el-main class="case-content">
|
||||||
<ms-table-header :condition.sync="condition" @search="search" title="" :show-create="false"/>
|
<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"
|
@filter-change="filter" row-key="id"
|
||||||
@select-all="handleSelectAll"
|
@select-all="handleSelectAll"
|
||||||
@select="handleSelectionChange"
|
@select="handleSelectionChange"
|
||||||
|
@ -202,7 +200,7 @@
|
||||||
buildPagePath(path) {
|
buildPagePath(path) {
|
||||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||||
},
|
},
|
||||||
getReviews() {
|
getReviews(flag) {
|
||||||
if (this.reviewId) {
|
if (this.reviewId) {
|
||||||
this.condition.reviewId = this.reviewId;
|
this.condition.reviewId = this.reviewId;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +218,7 @@
|
||||||
tableData.forEach(item => {
|
tableData.forEach(item => {
|
||||||
item.checked = false;
|
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;
|
this.lineStatus = tableData.length === 50 && this.testReviews.length < this.total;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -301,18 +299,16 @@
|
||||||
switchProject() {
|
switchProject() {
|
||||||
this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'});
|
this.$refs.switchProject.open({id: this.reviewId, url: '/test/case/review/project/', type: 'review'});
|
||||||
},
|
},
|
||||||
loadData() {
|
scrollLoading() {
|
||||||
if (this.dialogFormVisible) {
|
if (this.dialogFormVisible && this.lineStatus) {
|
||||||
if (this.lineStatus) {
|
this.currentPage += 1;
|
||||||
this.currentPage += 1;
|
this.getReviews();
|
||||||
this.getReviews();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
search() {
|
search() {
|
||||||
this.currentPage = 1;
|
this.currentPage = 1;
|
||||||
this.testReviews = [];
|
this.testReviews = [];
|
||||||
this.getReviews();
|
this.getReviews(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
getProjectNode(projectId) {
|
getProjectNode(projectId) {
|
||||||
|
|
Loading…
Reference in New Issue