This commit is contained in:
chenjianxing 2020-07-09 15:09:01 +08:00
commit cf9cffb114
7 changed files with 182 additions and 123 deletions

View File

@ -50,8 +50,8 @@ public class APITestController {
return apiTestService.getApiTestByProjectId(projectId); return apiTestService.getApiTestByProjectId(projectId);
} }
/*查询某个api测试状态*/
@GetMapping("/list/all/{testId}") @GetMapping("/state/get/{testId}")
public ApiTest apiState(@PathVariable String testId) { public ApiTest apiState(@PathVariable String testId) {
return apiTestService.getApiTestByTestId(testId); return apiTestService.getApiTestByTestId(testId);
} }

View File

@ -3,7 +3,7 @@
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestCaseMapper"> <mapper namespace="io.metersphere.base.mapper.ext.ExtTestCaseMapper">
<select id="getTestCaseNames" resultType="io.metersphere.base.domain.TestCase"> <select id="getTestCaseNames" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name select test_case.id, test_case.name, test_case.priority, test_case.type
from test_case from test_case
<where> <where>
<if test="request.projectId != null"> <if test="request.projectId != null">
@ -16,6 +16,16 @@
</foreach> </foreach>
</if> </if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
and test_case.${key} in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</if>
</foreach>
</if>
</where> </where>
ORDER BY test_case.update_time DESC ORDER BY test_case.update_time DESC
</select> </select>

View File

@ -71,6 +71,9 @@
<if test="request.planId != null"> <if test="request.planId != null">
and test_plan_test_case.plan_id = #{request.planId} and test_plan_test_case.plan_id = #{request.planId}
</if> </if>
<if test="request.method != null">
and test_case.method = #{request.method}
</if>
<if test="request.nodePaths != null and request.nodePaths.size() > 0"> <if test="request.nodePaths != null and request.nodePaths.size() > 0">
and test_case.node_path in and test_case.node_path in

View File

@ -56,7 +56,6 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/swagger-ui/**", "anon"); filterChainDefinitionMap.put("/swagger-ui/**", "anon");
filterChainDefinitionMap.put("/v3/api-docs/**", "anon"); filterChainDefinitionMap.put("/v3/api-docs/**", "anon");
filterChainDefinitionMap.put("/api/**", "anon");
filterChainDefinitionMap.put("/403", "anon"); filterChainDefinitionMap.put("/403", "anon");
filterChainDefinitionMap.put("/anonymous/**", "anon"); filterChainDefinitionMap.put("/anonymous/**", "anon");
filterChainDefinitionMap.put("/**", "apikey, authc"); filterChainDefinitionMap.put("/**", "apikey, authc");

View File

@ -55,8 +55,8 @@ public class PerformanceTestController {
return performanceTestService.getLoadTestByProjectId(projectId); return performanceTestService.getLoadTestByProjectId(projectId);
} }
/*查询某个测试状态*/
@GetMapping("/list/all/{testId}") @GetMapping("/state/get/{testId}")
public LoadTest listByTestId(@PathVariable String testId) { public LoadTest listByTestId(@PathVariable String testId) {
return performanceTestService.getLoadTestBytestId(testId); return performanceTestService.getLoadTestBytestId(testId);
} }

View File

@ -42,6 +42,7 @@ public class TestPlanTestCaseController {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest(); QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setPlanId(planId); request.setPlanId(planId);
request.setNodePaths(list); request.setNodePaths(list);
request.setMethod("auto");
return testPlanTestCaseService.listByNode(request); return testPlanTestCaseService.listByNode(request);
} }

View File

@ -19,26 +19,47 @@
<el-container> <el-container>
<el-main class="case-content" v-loading="result.loading"> <el-main class="case-content" v-loading="result.loading">
<el-table <el-table
:data="testCases" :data="testCases"
row-key="id" @filter-change="filter"
@select-all="handleSelectAll" row-key="id"
@select="handleSelectionChange" @select-all="handleSelectAll"
height="70vh" @select="handleSelectionChange"
ref="table"> height="70vh"
ref="table">
<el-table-column <el-table-column
type="selection"></el-table-column> type="selection"></el-table-column>
<el-table-column <el-table-column
prop="name" prop="name"
:label="$t('test_track.case.name')" :label="$t('test_track.case.name')"
style="width: 100%"> style="width: 100%">
<template v-slot:default="scope"> <template v-slot:default="scope">
{{scope.row.name}} {{scope.row.name}}
</template> </template>
</el-table-column> </el-table-column>
</el-table> <el-table-column
prop="priority"
:filters="priorityFilters"
column-key="priority"
:label="$t('test_track.case.priority')"
show-overflow-tooltip>
<template v-slot:default="scope">
<priority-table-item :value="scope.row.priority"/>
</template>
</el-table-column>
<el-table-column
prop="type"
:filters="typeFilters"
column-key="type"
:label="$t('test_track.case.type')"
show-overflow-tooltip>
<template v-slot:default="scope">
<type-table-item :value="scope.row.type"/>
</template>
</el-table-column>
</el-table>
</el-main> </el-main>
</el-container> </el-container>
</el-container> </el-container>
@ -56,107 +77,128 @@
import NodeTree from '../../../common/NodeTree'; import NodeTree from '../../../common/NodeTree';
import MsDialogFooter from '../../../../common/components/MsDialogFooter' import MsDialogFooter from '../../../../common/components/MsDialogFooter'
import PriorityTableItem from "../../../common/tableItems/planview/PriorityTableItem";
import TypeTableItem from "../../../common/tableItems/planview/TypeTableItem";
import {_filter} from "../../../../../../common/js/utils";
export default { export default {
name: "TestCaseRelevance", name: "TestCaseRelevance",
components: {NodeTree, MsDialogFooter}, components: {NodeTree, MsDialogFooter, PriorityTableItem, TypeTableItem},
data() { data() {
return { return {
result: {}, result: {},
dialogFormVisible: false, dialogFormVisible: false,
isCheckAll: false, isCheckAll: false,
testCases: [], testCases: [],
selectIds: new Set(), selectIds: new Set(),
treeNodes: [], treeNodes: [],
selectNodeIds: [], selectNodeIds: [],
selectNodeNames: [] selectNodeNames: [],
}; condition: {},
}, priorityFilters: [
props: { {text: 'P0', value: 'P0'},
planId: { {text: 'P1', value: 'P1'},
type: String {text: 'P2', value: 'P2'},
} {text: 'P3', value: 'P3'}
}, ],
watch: { typeFilters: [
planId() { {text: this.$t('commons.functional'), value: 'functional'},
this.initData(); {text: this.$t('commons.performance'), value: 'performance'},
}, {text: this.$t('commons.api'), value: 'api'}
selectNodeIds() { ]
this.getCaseNames(); };
} },
}, props: {
methods: { planId: {
openTestCaseRelevanceDialog() { type: String
this.initData();
this.dialogFormVisible = true;
},
saveCaseRelevance(){
let param = {};
param.planId = this.planId;
param.testCaseIds = [...this.selectIds];
this.$post('/test/plan/relevance' , param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false;
this.$emit('refresh');
});
},
getCaseNames() {
let param = {};
if (this.planId) {
param.planId = this.planId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0){
param.nodeIds = this.selectNodeIds;
}
this.result = this.$post('/test/case/name', param, response => {
this.testCases = response.data;
this.testCases.forEach(item => {
item.checked = false;
});
});
},
handleSelectAll(selection) {
if(selection.length > 0){
this.testCases.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);
}
},
nodeChange(nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
initData() {
this.getCaseNames();
this.getAllNodeTreeByPlanId();
},
refresh() {
this.close();
},
getAllNodeTreeByPlanId() {
if (this.planId) {
this.result = this.$get("/case/node/list/all/plan/" + this.planId, response => {
this.treeNodes = response.data;
});
}
},
close() {
this.selectIds.clear();
this.selectNodeIds = [];
this.selectNodeNames = [];
}
} }
},
watch: {
planId() {
this.initData();
},
selectNodeIds() {
this.getCaseNames();
}
},
methods: {
openTestCaseRelevanceDialog() {
this.initData();
this.dialogFormVisible = true;
},
saveCaseRelevance() {
let param = {};
param.planId = this.planId;
param.testCaseIds = [...this.selectIds];
this.$post('/test/plan/relevance', param, () => {
this.selectIds.clear();
this.$success(this.$t('commons.save_success'));
this.dialogFormVisible = false;
this.$emit('refresh');
});
},
getCaseNames() {
let param = {};
if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId;
}
if (this.selectNodeIds && this.selectNodeIds.length > 0) {
// param.nodeIds = this.selectNodeIds;
this.condition.nodeIds = this.selectNodeIds;
}
this.result = this.$post('/test/case/name', this.condition, response => {
this.testCases = response.data;
this.testCases.forEach(item => {
item.checked = false;
});
});
},
handleSelectAll(selection) {
if (selection.length > 0) {
this.testCases.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);
}
},
nodeChange(nodeIds, nodeNames) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
},
initData() {
this.getCaseNames();
this.getAllNodeTreeByPlanId();
},
refresh() {
this.close();
},
getAllNodeTreeByPlanId() {
if (this.planId) {
this.result = this.$get("/case/node/list/all/plan/" + this.planId, response => {
this.treeNodes = response.data;
});
}
},
close() {
this.selectIds.clear();
this.selectNodeIds = [];
this.selectNodeNames = [];
},
filter(filters) {
_filter(filters, this.condition);
this.initData();
},
} }
}
</script> </script>
<style scoped> <style scoped>
@ -165,16 +207,18 @@
display: none; display: none;
color: black; color: black;
} }
.tb-edit .current-row .el-input { .tb-edit .current-row .el-input {
display: block; display: block;
} }
.tb-edit .current-row .el-input+span {
.tb-edit .current-row .el-input + span {
display: none; display: none;
} }
.node-tree{ .node-tree {
margin-right: 10px; margin-right: 10px;
} }
@ -189,10 +233,12 @@
height: 100%; height: 100%;
/*border: 1px solid #EBEEF5;*/ /*border: 1px solid #EBEEF5;*/
} }
.tree-aside { .tree-aside {
min-height: 300px; min-height: 300px;
max-height: 100%; max-height: 100%;
} }
.main-content { .main-content {
min-height: 300px; min-height: 300px;
height: 100%; height: 100%;