feat(测试测试): 测试计划和评审关联功能用例模块树优化
--story=1008229 --user=陈建星 功能用例优化 https://www.tapd.cn/55049933/s/1193969
This commit is contained in:
parent
64d5b77226
commit
994e30e9d5
|
@ -111,6 +111,10 @@ public interface ExtTestCaseMapper {
|
|||
|
||||
List<TestCaseNodeDTO> getCountNodes(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
List<TestCaseNodeDTO> getTestPlanRelateCountNodes(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
List<TestCaseNodeDTO> getTestReviewRelateCountNodes(@Param("request") QueryTestCaseRequest request);
|
||||
|
||||
List<TestCaseWithBLOBs> getCustomFieldsByIds(@Param("ids") List<String> ids);
|
||||
|
||||
int deleteToGc(@Param("request") DeleteTestCaseRequest testCase);
|
||||
|
|
|
@ -303,7 +303,25 @@
|
|||
from test_case
|
||||
inner join test_case_node tcn on test_case.node_id = tcn.id
|
||||
<include refid="queryWhereCondition"/>
|
||||
group by test_case.node_id;
|
||||
group by test_case.node_id
|
||||
</select>
|
||||
<select id="getTestPlanRelateCountNodes" resultType="io.metersphere.track.dto.TestCaseNodeDTO">
|
||||
select tcn.id, count(*) as caseNum, test_case.project_id
|
||||
from test_case
|
||||
left join test_plan_test_case tptc on tptc.case_id = test_case.id and tptc.plan_id = #{request.planId}
|
||||
inner join test_case_node tcn on test_case.node_id = tcn.id
|
||||
<include refid="queryWhereCondition"/>
|
||||
and tptc.case_id is null
|
||||
group by test_case.node_id
|
||||
</select>
|
||||
<select id="getTestReviewRelateCountNodes" resultType="io.metersphere.track.dto.TestCaseNodeDTO">
|
||||
select tcn.id, count(*) as caseNum, test_case.project_id
|
||||
from test_case
|
||||
left join test_case_review_test_case tcrtc on tcrtc.case_id = test_case.id and tcrtc.review_id = #{request.reviewId}
|
||||
inner join test_case_node tcn on test_case.node_id = tcn.id
|
||||
<include refid="queryWhereCondition"/>
|
||||
and tcrtc.case_id is null
|
||||
group by test_case.node_id
|
||||
</select>
|
||||
<select id="listByMethod" resultType="io.metersphere.track.dto.TestCaseDTO">
|
||||
select load_test.id, load_test.name, load_test.project_id,'性能测试' as type, project_version.name as version_name
|
||||
|
|
|
@ -56,23 +56,12 @@ public class TestCaseNodeController {
|
|||
return testCaseNodeService.publicCount(workSpaceId);
|
||||
}
|
||||
|
||||
/*模块列表列表*/
|
||||
@PostMapping("/list/all/plan")
|
||||
public List<TestCaseNodeDTO> getAllNodeByPlanId(@RequestBody QueryNodeRequest request) {
|
||||
return testCaseNodeService.getAllNodeByPlanId(request);
|
||||
}
|
||||
|
||||
/*模块列表列表*/
|
||||
@PostMapping("/list/project")
|
||||
public List<TestCaseNodeDTO> getAllNodeByProjectId(@RequestBody QueryNodeRequest request) {
|
||||
return testCaseNodeService.getAllNodeByProjectId(request);
|
||||
}
|
||||
|
||||
@PostMapping("/list/all/review")
|
||||
public List<TestCaseNodeDTO> getAllNodeByReviewId(@RequestBody QueryNodeRequest request) {
|
||||
return testCaseNodeService.getAllNodeByReviewId(request);
|
||||
}
|
||||
|
||||
@GetMapping("/list/plan/{planId}")
|
||||
public List<TestCaseNodeDTO> getNodeByPlanId(@PathVariable String planId) {
|
||||
checkPermissionService.checkTestPlanOwner(planId);
|
||||
|
@ -85,6 +74,18 @@ public class TestCaseNodeController {
|
|||
return testCaseNodeService.getNodeByPlanId(planId, Optional.ofNullable(request).orElse(new QueryTestPlanCaseRequest()));
|
||||
}
|
||||
|
||||
@PostMapping("/list/plan/relate")
|
||||
public List<TestCaseNodeDTO> getRelatePlanNodes(@RequestBody QueryTestCaseRequest request) {
|
||||
checkPermissionService.checkTestPlanOwner(request.getPlanId());
|
||||
return testCaseNodeService.getRelatePlanNodes(request);
|
||||
}
|
||||
|
||||
@PostMapping("/list/review/relate")
|
||||
public List<TestCaseNodeDTO> getRelateReviewNodes(@RequestBody QueryTestCaseRequest request) {
|
||||
checkPermissionService.checkTestReviewOwner(request.getReviewId());
|
||||
return testCaseNodeService.getRelateReviewNodes(request);
|
||||
}
|
||||
|
||||
@GetMapping("/list/plan/{planId}/{runResult}")
|
||||
public List<TestCaseNodeDTO> getNodeByPlanIdAndRunResult(@PathVariable String planId, @PathVariable String runResult) {
|
||||
checkPermissionService.checkTestPlanOwner(planId);
|
||||
|
|
|
@ -343,29 +343,22 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
|
|||
return getNodeTreeWithPruningTree(testCaseNodes, dataNodeIds);
|
||||
}
|
||||
|
||||
public List<TestCaseNodeDTO> getAllNodeByPlanId(QueryNodeRequest request) {
|
||||
String planId = request.getTestPlanId();
|
||||
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(planId);
|
||||
if (testPlan == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getAllNodeByProjectId(request);
|
||||
public List<TestCaseNodeDTO> getRelatePlanNodes(QueryTestCaseRequest request) {
|
||||
List<TestCaseNodeDTO> countMNodes = extTestCaseMapper.getTestPlanRelateCountNodes(request);
|
||||
List<TestCaseNodeDTO> testCaseNodes = extTestCaseNodeMapper.getNodeTreeByProjectId(request.getProjectId());
|
||||
return getNodeTreeWithPruningTreeByCaseCount(testCaseNodes, getCountMap(countMNodes));
|
||||
}
|
||||
|
||||
public List<TestCaseNodeDTO> getRelateReviewNodes(QueryTestCaseRequest request) {
|
||||
List<TestCaseNodeDTO> countMNodes = extTestCaseMapper.getTestReviewRelateCountNodes(request);
|
||||
List<TestCaseNodeDTO> testCaseNodes = extTestCaseNodeMapper.getNodeTreeByProjectId(request.getProjectId());
|
||||
return getNodeTreeWithPruningTreeByCaseCount(testCaseNodes, getCountMap(countMNodes));
|
||||
}
|
||||
|
||||
public List<TestCaseNodeDTO> getAllNodeByProjectId(QueryNodeRequest request) {
|
||||
return getNodeTreeByProjectId(request.getProjectId());
|
||||
}
|
||||
|
||||
public List<TestCaseNodeDTO> getAllNodeByReviewId(QueryNodeRequest request) {
|
||||
String reviewId = request.getReviewId();
|
||||
String projectId = request.getProjectId();
|
||||
TestCaseReview testCaseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId);
|
||||
if (testCaseReview == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getNodeTreeByProjectId(projectId);
|
||||
}
|
||||
|
||||
public Map<String, String> createNodeByTestCases(List<TestCaseWithBLOBs> testCases, String projectId) {
|
||||
List<String> nodePaths = testCases.stream()
|
||||
.map(TestCase::getNodePath)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<slot name="header"></slot>
|
||||
|
||||
<ms-node-tree
|
||||
:is-display="getIsRelevance"
|
||||
v-loading="result.loading"
|
||||
:tree-nodes="data"
|
||||
:allLabel="$t('api_test.automation.all_scenario')"
|
||||
|
@ -86,18 +85,10 @@ export default {
|
|||
},
|
||||
projectId() {
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
getIsRelevance() {
|
||||
if (this.pageSource !== 'scenario') {
|
||||
return this.openType;
|
||||
} else {
|
||||
return "scenario";
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
openType: 'relevance',
|
||||
result: {},
|
||||
condition: {
|
||||
filterText: "",
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<slot name="header"></slot>
|
||||
|
||||
<ms-node-tree
|
||||
:is-display="getIsRelevance"
|
||||
v-loading="result.loading"
|
||||
:tree-nodes="data"
|
||||
:type="isReadOnly ? 'view' : 'edit'"
|
||||
|
@ -67,7 +66,6 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
openType: 'relevance',
|
||||
result: {},
|
||||
condition: {
|
||||
protocol: OPTIONS[0].value,
|
||||
|
@ -112,13 +110,6 @@ export default {
|
|||
},
|
||||
projectId() {
|
||||
return getCurrentProjectID();
|
||||
},
|
||||
getIsRelevance(){
|
||||
if(this.pageSource !== 'definition'){
|
||||
return this.openType;
|
||||
}else {
|
||||
return "definition";
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
@ -86,7 +86,7 @@ export default {
|
|||
});
|
||||
},
|
||||
getTreeNodes(vueObj) {
|
||||
vueObj.$refs.nodeTree.result = getTestCaseNodesByCaseFilter(vueObj.projectId, {}, data => {
|
||||
vueObj.nodeResult = getTestCaseNodesByCaseFilter(vueObj.projectId, {}, data => {
|
||||
vueObj.treeNodes = data;
|
||||
vueObj.selectNodeIds = [];
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<span v-if="!data.isEdit" class="node-title" v-text="isDefault(data) ? getLocalDefaultName() : data.name"/>
|
||||
</el-tooltip>
|
||||
|
||||
<span class="count-title" v-if="isDisplay !== 'relevance'">
|
||||
<span class="count-title" v-if="data.caseNum !== null && data.caseNum !== undefined">
|
||||
<span style="color: #6C317C">{{ data.caseNum }}</span>
|
||||
</span>
|
||||
<span v-if="!disabled" class="node-operate child">
|
||||
|
@ -114,9 +114,6 @@ export default {
|
|||
};
|
||||
},
|
||||
props: {
|
||||
isDisplay: {
|
||||
type: String,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: "view"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<template>
|
||||
<ms-node-tree class="node-tree"
|
||||
:is-display="'public'"
|
||||
v-loading="result.loading"
|
||||
local-suffix="test_case"
|
||||
default-label="未规划用例"
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
<template v-slot:aside>
|
||||
<node-tree class="node-tree"
|
||||
:is-display="openType"
|
||||
v-loading="result.loading"
|
||||
v-loading="nodeResult.loading"
|
||||
local-suffix="test_case"
|
||||
default-label="未规划用例"
|
||||
@nodeSelectEvent="nodeChange"
|
||||
|
@ -107,7 +106,6 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
|
|||
import MsTable from "@/business/components/common/components/table/MsTable";
|
||||
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
|
||||
import MsTag from "@/business/components/common/components/MsTag";
|
||||
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
|
||||
import MsCreateTimeColumn from "@/business/components/common/components/table/MsCreateTimeColumn";
|
||||
import MsUpdateTimeColumn from "@/business/components/common/components/table/MsUpdateTimeColumn";
|
||||
import {getVersionFilters} from "@/network/project";
|
||||
|
@ -138,8 +136,8 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
openType: 'relevance',
|
||||
result: {},
|
||||
nodeResult: {},
|
||||
isSaving: false,
|
||||
treeNodes: [],
|
||||
selectNodeIds: [],
|
||||
|
@ -223,6 +221,7 @@ export default {
|
|||
// 添加搜索条件时,当前页设置成第一页
|
||||
this.page.currentPage = 1;
|
||||
this.getTestCases();
|
||||
this.getProjectNode(this.projectId, this.page.condition);
|
||||
},
|
||||
getTestCases() {
|
||||
let condition = this.page.condition;
|
||||
|
@ -255,7 +254,7 @@ export default {
|
|||
this.selectNodeNames = [];
|
||||
this.$refs.table.clear();
|
||||
},
|
||||
getProjectNode(projectId) {
|
||||
getProjectNode(projectId, condition) {
|
||||
const index = this.projects.findIndex(project => project.id === projectId);
|
||||
if (index !== -1) {
|
||||
this.projectName = this.projects[index].name;
|
||||
|
@ -263,7 +262,7 @@ export default {
|
|||
if (projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
this.getNodeTree(this);
|
||||
this.getNodeTree(this, condition);
|
||||
},
|
||||
getVersionOptions() {
|
||||
getVersionFilters(this.projectId, (data) => {
|
||||
|
|
|
@ -84,9 +84,9 @@ export default {
|
|||
});
|
||||
});
|
||||
},
|
||||
getTreeNodes(vueObj) {
|
||||
vueObj.$refs.nodeTree.result = this.$post("/case/node/list/all/plan",
|
||||
{testPlanId: this.planId, projectId: vueObj.projectId}, response => {
|
||||
getTreeNodes(vueObj, condition) {
|
||||
vueObj.nodeResult = this.$post("/case/node/list/plan/relate",
|
||||
{planId: this.planId, projectId: vueObj.projectId, ...condition}, response => {
|
||||
vueObj.treeNodes = response.data;
|
||||
});
|
||||
vueObj.selectNodeIds = [];
|
||||
|
|
|
@ -294,17 +294,6 @@ export default {
|
|||
refresh() {
|
||||
this.close();
|
||||
},
|
||||
getAllNodeTreeByPlanId() {
|
||||
if (this.planId) {
|
||||
let param = {
|
||||
testPlanId: this.planId,
|
||||
projectId: this.projectId
|
||||
};
|
||||
this.result = this.$post("/case/node/list/all/plan", param, response => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.selectIds.clear();
|
||||
this.selectNodeIds = [];
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
:title="$t('test_track.switch_project')"
|
||||
@dataChange="changeProject"/>
|
||||
<node-tree class="node-tree"
|
||||
:is-display="openType"
|
||||
:all-label="$t('commons.all_label.review')"
|
||||
v-loading="result.loading"
|
||||
local-suffix="test_case"
|
||||
|
@ -211,7 +210,7 @@ export default {
|
|||
},
|
||||
selectNodeIds() {
|
||||
if (this.dialogFormVisible) {
|
||||
this.search();
|
||||
this.getReviews();
|
||||
}
|
||||
},
|
||||
projectId() {
|
||||
|
@ -258,7 +257,7 @@ export default {
|
|||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
getReviews(flag) {
|
||||
getReviews() {
|
||||
if (this.reviewId) {
|
||||
this.condition.reviewId = this.reviewId;
|
||||
}
|
||||
|
@ -288,17 +287,6 @@ export default {
|
|||
refresh() {
|
||||
this.close();
|
||||
},
|
||||
getAllNodeTreeByPlanId() {
|
||||
if (this.reviewId) {
|
||||
let param = {
|
||||
reviewId: this.reviewId,
|
||||
projectId: this.projectId
|
||||
};
|
||||
this.result = this.$post("/case/node/list/all/review", param, response => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.lineStatus = false;
|
||||
this.selectIds.clear();
|
||||
|
@ -347,13 +335,13 @@ export default {
|
|||
search() {
|
||||
this.currentPage = 1;
|
||||
this.testReviews = [];
|
||||
this.getReviews(true);
|
||||
this.getReviews();
|
||||
this.getProjectNode(this.projectId, this.condition);
|
||||
},
|
||||
changeProject(project) {
|
||||
this.projectId = project.id;
|
||||
},
|
||||
|
||||
getProjectNode(projectId) {
|
||||
getProjectNode(projectId, condition) {
|
||||
const index = this.projects.findIndex(project => project.id === projectId);
|
||||
if (index !== -1) {
|
||||
this.projectName = this.projects[index].name;
|
||||
|
@ -362,8 +350,8 @@ export default {
|
|||
if (projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
this.result = this.$post("/case/node/list/all/review",
|
||||
{reviewId: this.reviewId, projectId: this.projectId}, response => {
|
||||
this.result = this.$post("/case/node/list/review/relate",
|
||||
{reviewId: this.reviewId, projectId: this.projectId, ...condition}, response => {
|
||||
this.treeNodes = response.data;
|
||||
});
|
||||
this.selectNodeIds = [];
|
||||
|
|
Loading…
Reference in New Issue