refactor(测试计划): 性能测试用例执行优化
This commit is contained in:
parent
7cd5d8c661
commit
2bba395f40
|
@ -63,9 +63,9 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
refresh() {
|
||||
this.selectNodeIds = [];
|
||||
this.selectProjectId = '';
|
||||
this.selectParentNodes = [];
|
||||
this.$refs.testCaseLoadRelevance.search();
|
||||
this.$refs.testPlanLoadCaseList.initTable();
|
||||
this.getNodeTreeByPlanId();
|
||||
},
|
||||
initData() {
|
||||
|
|
|
@ -143,7 +143,8 @@ export default {
|
|||
{text: 'Error', value: 'Error'}
|
||||
],
|
||||
reportId: '',
|
||||
loading: false
|
||||
loading: false,
|
||||
statusScheduler: null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
@ -156,6 +157,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.initTable();
|
||||
this.refreshStatus();
|
||||
},
|
||||
watch: {
|
||||
selectProjectId() {
|
||||
|
@ -179,6 +181,16 @@ export default {
|
|||
this.tableData = data.listObject;
|
||||
})
|
||||
},
|
||||
refreshStatus() {
|
||||
this.refreshScheduler = setInterval(() => {
|
||||
let arr = this.tableData.filter(data => data.status !== 'Completed' && data.status !== 'Error');
|
||||
if (arr.length > 0) {
|
||||
this.initTable();
|
||||
} else {
|
||||
clearInterval(this.refreshScheduler);
|
||||
}
|
||||
}, 4000);
|
||||
},
|
||||
handleSelectAll(selection) {
|
||||
if (selection.length > 0) {
|
||||
this.tableData.forEach(item => {
|
||||
|
@ -220,17 +232,29 @@ export default {
|
|||
})
|
||||
},
|
||||
handleRunBatch() {
|
||||
|
||||
this.selectRows.forEach(loadCase => {
|
||||
this.run(loadCase);
|
||||
})
|
||||
},
|
||||
run(loadCase) {
|
||||
this.$post('/test/plan/load/case/run', {
|
||||
id: loadCase.loadCaseId,
|
||||
testPlanLoadId: loadCase.id,
|
||||
triggerMode: 'MANUAL'
|
||||
}, response => {
|
||||
let reportId = response.data;
|
||||
}).then(() => {
|
||||
this.$notify({
|
||||
title: loadCase.caseName,
|
||||
message: '正在执行....',
|
||||
type: 'success'
|
||||
});
|
||||
this.initTable();
|
||||
}).catch(() => {
|
||||
this.$notify.error({
|
||||
title: loadCase.caseName,
|
||||
message: '用例执行错误,请单独调试该用例!'
|
||||
});
|
||||
})
|
||||
this.refreshStatus();
|
||||
},
|
||||
handleDelete(loadCase) {
|
||||
this.result = this.$get('/test/plan/load/case/delete/' + loadCase.id, () => {
|
||||
|
@ -268,8 +292,16 @@ export default {
|
|||
// this.initTable();
|
||||
}
|
||||
})
|
||||
},
|
||||
cancelRefresh() {
|
||||
if (this.refreshScheduler) {
|
||||
clearInterval(this.refreshScheduler);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.cancelRefresh();
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue