fix (接口自动化): 单条场景执行支持导出及生成测试报告
This commit is contained in:
parent
87d6833400
commit
99ca5a6e08
|
@ -459,6 +459,8 @@ export default {
|
||||||
isTop: false,
|
isTop: false,
|
||||||
stepSize: 0,
|
stepSize: 0,
|
||||||
message: "",
|
message: "",
|
||||||
|
websocket: {},
|
||||||
|
messageWebSocket: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -503,10 +505,27 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
clearNodeStatus(arr) {
|
||||||
|
if (arr) {
|
||||||
|
arr.forEach(item => {
|
||||||
|
item.code = undefined;
|
||||||
|
item.data.code = undefined;
|
||||||
|
item.testing = undefined;
|
||||||
|
item.data.testing = undefined;
|
||||||
|
if (item.childNodes && item.childNodes.length > 0) {
|
||||||
|
this.clearNodeStatus(item.childNodes);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
evaluationParent(node, status) {
|
evaluationParent(node, status) {
|
||||||
|
if (!node.data.code) {
|
||||||
|
node.data.code = "success";
|
||||||
|
}
|
||||||
if (!status) {
|
if (!status) {
|
||||||
node.data.code = "error";
|
node.data.code = "error";
|
||||||
}
|
}
|
||||||
|
node.data.testing = false;
|
||||||
node.data.debug = true;
|
node.data.debug = true;
|
||||||
if (node.parent && node.parent.data && node.parent.data.id) {
|
if (node.parent && node.parent.data && node.parent.data.id) {
|
||||||
this.evaluationParent(node.parent, status);
|
this.evaluationParent(node.parent, status);
|
||||||
|
@ -515,6 +534,7 @@ export default {
|
||||||
resultEvaluationChild(arr, resourceId, status) {
|
resultEvaluationChild(arr, resourceId, status) {
|
||||||
arr.forEach(item => {
|
arr.forEach(item => {
|
||||||
if (item.data.resourceId === resourceId) {
|
if (item.data.resourceId === resourceId) {
|
||||||
|
item.data.testing = false;
|
||||||
this.evaluationParent(item.parent, status);
|
this.evaluationParent(item.parent, status);
|
||||||
}
|
}
|
||||||
if (item.childNodes && item.childNodes.length > 0) {
|
if (item.childNodes && item.childNodes.length > 0) {
|
||||||
|
@ -525,6 +545,9 @@ export default {
|
||||||
resultEvaluation(resourceId, status) {
|
resultEvaluation(resourceId, status) {
|
||||||
if (this.$refs.stepTree && this.$refs.stepTree.root) {
|
if (this.$refs.stepTree && this.$refs.stepTree.root) {
|
||||||
this.$refs.stepTree.root.childNodes.forEach(item => {
|
this.$refs.stepTree.root.childNodes.forEach(item => {
|
||||||
|
if (item.data.resourceId === resourceId) {
|
||||||
|
item.data.testing = false;
|
||||||
|
}
|
||||||
if (item.childNodes && item.childNodes.length > 0) {
|
if (item.childNodes && item.childNodes.length > 0) {
|
||||||
this.resultEvaluationChild(item.childNodes, resourceId, status);
|
this.resultEvaluationChild(item.childNodes, resourceId, status);
|
||||||
}
|
}
|
||||||
|
@ -539,14 +562,6 @@ export default {
|
||||||
const uri = protocol + window.location.host + "/api/scenario/report/get/real/" + this.reportId;
|
const uri = protocol + window.location.host + "/api/scenario/report/get/real/" + this.reportId;
|
||||||
this.websocket = new WebSocket(uri);
|
this.websocket = new WebSocket(uri);
|
||||||
this.websocket.onmessage = this.onMessage;
|
this.websocket.onmessage = this.onMessage;
|
||||||
this.websocket.onopen = this.onOpen;
|
|
||||||
this.websocket.onerror = this.onError;
|
|
||||||
this.websocket.onclose = this.onClose;
|
|
||||||
},
|
|
||||||
onOpen() {
|
|
||||||
},
|
|
||||||
onError(e) {
|
|
||||||
window.console.error(e)
|
|
||||||
},
|
},
|
||||||
onMessage(e) {
|
onMessage(e) {
|
||||||
if (e.data) {
|
if (e.data) {
|
||||||
|
@ -560,12 +575,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClose(e) {
|
|
||||||
if (e.code === 1005) {
|
|
||||||
// 强制删除之后关闭socket,不用刷新report
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getTransaction(transRequests, startTime, endTime, resMap) {
|
getTransaction(transRequests, startTime, endTime, resMap) {
|
||||||
transRequests.forEach(subItem => {
|
transRequests.forEach(subItem => {
|
||||||
if (subItem.method === 'Request') {
|
if (subItem.method === 'Request') {
|
||||||
|
@ -593,6 +602,52 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initMessageSocket() {
|
||||||
|
let protocol = "ws://";
|
||||||
|
if (window.location.protocol === 'https:') {
|
||||||
|
protocol = "wss://";
|
||||||
|
}
|
||||||
|
const uri = protocol + window.location.host + "/ws/" + this.reportId;
|
||||||
|
this.messageWebSocket = new WebSocket(uri);
|
||||||
|
this.messageWebSocket.onmessage = this.onMessage2;
|
||||||
|
},
|
||||||
|
runningEditParent(node) {
|
||||||
|
if (node) {
|
||||||
|
node.data.testing = true;
|
||||||
|
if (node.parent && node.parent.data && node.parent.data.id) {
|
||||||
|
this.runningEditParent(node.parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
runningNodeChild(arr, resourceId) {
|
||||||
|
arr.forEach(item => {
|
||||||
|
if (item.data && item.data.resourceId === resourceId) {
|
||||||
|
item.data.testing = true;
|
||||||
|
this.runningEditParent(item.parent);
|
||||||
|
}
|
||||||
|
if (item.childNodes && item.childNodes.length > 0) {
|
||||||
|
this.runningNodeChild(item.childNodes, resourceId);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
runningEvaluation(resourceId) {
|
||||||
|
if (this.$refs.stepTree && this.$refs.stepTree.root) {
|
||||||
|
this.$refs.stepTree.root.childNodes.forEach(item => {
|
||||||
|
if (item.data && item.data.resourceId === resourceId) {
|
||||||
|
item.data.testing = true;
|
||||||
|
}
|
||||||
|
if (item.childNodes && item.childNodes.length > 0) {
|
||||||
|
this.runningNodeChild(item.childNodes, resourceId);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onMessage2(e) {
|
||||||
|
this.runningEvaluation(e.data);
|
||||||
|
this.message = getUUID();
|
||||||
|
},
|
||||||
|
|
||||||
formatResult(res) {
|
formatResult(res) {
|
||||||
let resMap = new Map;
|
let resMap = new Map;
|
||||||
let startTime = 99991611737506593;
|
let startTime = 99991611737506593;
|
||||||
|
@ -642,6 +697,8 @@ export default {
|
||||||
removeReport() {
|
removeReport() {
|
||||||
let url = "/api/scenario/report/remove/real/" + this.reportId;
|
let url = "/api/scenario/report/remove/real/" + this.reportId;
|
||||||
this.$get(url, response => {
|
this.$get(url, response => {
|
||||||
|
this.messageWebSocket.close();
|
||||||
|
this.websocket.close();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleCommand() {
|
handleCommand() {
|
||||||
|
@ -971,6 +1028,7 @@ export default {
|
||||||
this.stopDebug = "";
|
this.stopDebug = "";
|
||||||
this.clearDebug();
|
this.clearDebug();
|
||||||
this.clearResult(this.scenarioDefinition);
|
this.clearResult(this.scenarioDefinition);
|
||||||
|
this.clearNodeStatus(this.$refs.stepTree.root.childNodes);
|
||||||
/*触发执行操作*/
|
/*触发执行操作*/
|
||||||
this.$refs.currentScenario.validate((valid) => {
|
this.$refs.currentScenario.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
@ -1215,6 +1273,7 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
} else {
|
} else {
|
||||||
this.initWebSocket();
|
this.initWebSocket();
|
||||||
|
this.initMessageSocket();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showScenarioParameters() {
|
showScenarioParameters() {
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
<el-tag size="mini" class="ms-tag" v-if="request.referenced ==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
|
<el-tag size="mini" class="ms-tag" v-if="request.referenced ==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:debugStepCode>
|
<template v-slot:debugStepCode>
|
||||||
|
<span v-if="request.testing" class="ms-test-running">
|
||||||
|
<i class="el-icon-loading" style="font-size: 16px"/>
|
||||||
|
{{$t('commons.testing')}}
|
||||||
|
</span>
|
||||||
<span class="ms-step-debug-code" :class="request.requestResult[0].success?'ms-req-success':'ms-req-error'" v-if="!loading && request.debug && request.requestResult[0] && request.requestResult[0].responseResult">
|
<span class="ms-step-debug-code" :class="request.requestResult[0].success?'ms-req-success':'ms-req-error'" v-if="!loading && request.debug && request.requestResult[0] && request.requestResult[0].responseResult">
|
||||||
{{ request.requestResult[0].success ? 'success' : 'error' }}
|
{{ request.requestResult[0].success ? 'success' : 'error' }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -496,6 +500,9 @@ export default {
|
||||||
.ms-req-error {
|
.ms-req-error {
|
||||||
color: #F56C6C;
|
color: #F56C6C;
|
||||||
}
|
}
|
||||||
|
.ms-test-running {
|
||||||
|
color: #6D317C;
|
||||||
|
}
|
||||||
|
|
||||||
.ms-req-success {
|
.ms-req-success {
|
||||||
color: #67C23A;
|
color: #67C23A;
|
||||||
|
|
|
@ -23,7 +23,11 @@
|
||||||
<span class="ms-tag">{{ getProjectName(scenario.projectId) }}</span>
|
<span class="ms-tag">{{ getProjectName(scenario.projectId) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:debugStepCode>
|
<template v-slot:debugStepCode>
|
||||||
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && node.data.debug">
|
<span v-if="node.data.testing" class="ms-test-running">
|
||||||
|
<i class="el-icon-loading" style="font-size: 16px"/>
|
||||||
|
{{ $t('commons.testing') }}
|
||||||
|
</span>
|
||||||
|
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && node.data.debug && !node.data.testing">
|
||||||
{{ getCode() }}
|
{{ getCode() }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -118,7 +122,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCode() {
|
getCode() {
|
||||||
if (this.node && this.node.data.debug) {
|
if (this.node && this.node.data.code && this.node.data.debug) {
|
||||||
if (this.node.data.code && this.node.data.code === 'error') {
|
if (this.node.data.code && this.node.data.code === 'error') {
|
||||||
return 'error';
|
return 'error';
|
||||||
} else {
|
} else {
|
||||||
|
@ -220,4 +224,7 @@ export default {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 60px;
|
width: 60px;
|
||||||
}
|
}
|
||||||
|
.ms-test-running {
|
||||||
|
color: #6D317C;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -27,7 +27,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:debugStepCode>
|
<template v-slot:debugStepCode>
|
||||||
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && node.data.debug && node.data.code">
|
<span v-if="node.data.testing" class="ms-test-running">
|
||||||
|
<i class="el-icon-loading" style="font-size: 16px"/>
|
||||||
|
{{ $t('commons.testing') }}
|
||||||
|
</span>
|
||||||
|
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && !node.data.testing && node.data.debug && node.data.code">
|
||||||
{{ getCode() }}
|
{{ getCode() }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -110,7 +114,7 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCode() {
|
getCode() {
|
||||||
if (this.node && this.node.data.debug) {
|
if (this.node && this.node.data.code && this.node.data.debug) {
|
||||||
if (this.node.data.code && this.node.data.code === 'error') {
|
if (this.node.data.code && this.node.data.code === 'error') {
|
||||||
return 'error';
|
return 'error';
|
||||||
} else {
|
} else {
|
||||||
|
@ -167,4 +171,7 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 80px;
|
width: 80px;
|
||||||
}
|
}
|
||||||
|
.ms-test-running {
|
||||||
|
color: #6D317C;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -15,7 +15,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-slot:debugStepCode>
|
<template v-slot:debugStepCode>
|
||||||
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && node.data.debug">
|
<span v-if="node.data.testing" class="ms-test-running">
|
||||||
|
<i class="el-icon-loading" style="font-size: 16px"/>
|
||||||
|
{{ $t('commons.testing') }}
|
||||||
|
</span>
|
||||||
|
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && !node.data.testing && node.data.debug">
|
||||||
{{ getCode() }}
|
{{ getCode() }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -78,7 +82,7 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCode() {
|
getCode() {
|
||||||
if (this.node && this.node.data.debug) {
|
if (this.node && this.node.data.code && this.node.data.debug) {
|
||||||
if (this.node.data.code && this.node.data.code === 'error') {
|
if (this.node.data.code && this.node.data.code === 'error') {
|
||||||
return 'error';
|
return 'error';
|
||||||
} else {
|
} else {
|
||||||
|
@ -124,4 +128,7 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
.ms-test-running {
|
||||||
|
color: #6D317C;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -71,7 +71,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-slot:debugStepCode>
|
<template v-slot:debugStepCode>
|
||||||
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && node.data.debug">
|
<span v-if="node.data.testing" class="ms-test-running">
|
||||||
|
<i class="el-icon-loading" style="font-size: 16px"/>
|
||||||
|
{{ $t('commons.testing') }}
|
||||||
|
</span>
|
||||||
|
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && !node.data.testing && node.data.debug">
|
||||||
{{ getCode() }}
|
{{ getCode() }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -164,7 +168,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCode() {
|
getCode() {
|
||||||
if (this.node && this.node.data.debug) {
|
if (this.node && this.node.data.code && this.node.data.debug) {
|
||||||
if (this.node.data.code && this.node.data.code === 'error') {
|
if (this.node.data.code && this.node.data.code === 'error') {
|
||||||
return 'error';
|
return 'error';
|
||||||
} else {
|
} else {
|
||||||
|
@ -398,6 +402,10 @@ export default {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ms-test-running {
|
||||||
|
color: #6D317C;
|
||||||
|
}
|
||||||
|
|
||||||
.ms-step-debug-code {
|
.ms-step-debug-code {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
|
|
|
@ -11,7 +11,11 @@
|
||||||
background-color="#FCF6EE"
|
background-color="#FCF6EE"
|
||||||
:title="$t('api_test.automation.transcation_controller')">
|
:title="$t('api_test.automation.transcation_controller')">
|
||||||
<template v-slot:debugStepCode>
|
<template v-slot:debugStepCode>
|
||||||
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && node.data.debug">
|
<span v-if="node.data.testing" class="ms-test-running">
|
||||||
|
<i class="el-icon-loading" style="font-size: 16px"/>
|
||||||
|
{{ $t('commons.testing') }}
|
||||||
|
</span>
|
||||||
|
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading &&!node.data.testing && node.data.debug">
|
||||||
{{ getCode() }}
|
{{ getCode() }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -109,7 +113,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getCode() {
|
getCode() {
|
||||||
if (this.node && this.node.data.debug) {
|
if (this.node && this.node.data.code && this.node.data.debug) {
|
||||||
if (this.node.data.code && this.node.data.code === 'error') {
|
if (this.node.data.code && this.node.data.code === 'error') {
|
||||||
return 'error';
|
return 'error';
|
||||||
} else {
|
} else {
|
||||||
|
@ -156,6 +160,7 @@ export default {
|
||||||
width: 15%;
|
width: 15%;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-req-error {
|
.ms-req-error {
|
||||||
color: #F56C6C;
|
color: #F56C6C;
|
||||||
}
|
}
|
||||||
|
@ -163,6 +168,7 @@ export default {
|
||||||
.ms-req-success {
|
.ms-req-success {
|
||||||
color: #67C23A;
|
color: #67C23A;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-step-debug-code {
|
.ms-step-debug-code {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
|
@ -173,4 +179,7 @@ export default {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
}
|
}
|
||||||
|
.ms-test-running {
|
||||||
|
color: #6D317C;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -322,7 +322,7 @@ export default {
|
||||||
{text: this.$t('api_test.automation.success'), value: 'success'},
|
{text: this.$t('api_test.automation.success'), value: 'success'},
|
||||||
{text: this.$t('api_test.automation.fail'), value: 'error'},
|
{text: this.$t('api_test.automation.fail'), value: 'error'},
|
||||||
{text: this.$t('api_test.home_page.detail_card.unexecute'), value: ''},
|
{text: this.$t('api_test.home_page.detail_card.unexecute'), value: ''},
|
||||||
{text: '测试中', value: 'Running'}
|
{text: this.$t('commons.testing'), value: 'Running'}
|
||||||
],
|
],
|
||||||
valueArr: {
|
valueArr: {
|
||||||
priority: CASE_PRIORITY,
|
priority: CASE_PRIORITY,
|
||||||
|
@ -465,7 +465,7 @@ export default {
|
||||||
case "error":
|
case "error":
|
||||||
return this.$t('api_test.automation.fail');
|
return this.$t('api_test.automation.fail');
|
||||||
case "Running":
|
case "Running":
|
||||||
return "测试中";
|
return this.$t('commons.testing');
|
||||||
default:
|
default:
|
||||||
return this.$t('api_test.home_page.detail_card.unexecute');
|
return this.$t('api_test.home_page.detail_card.unexecute');
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,6 +170,7 @@ export default {
|
||||||
executor: "Executor",
|
executor: "Executor",
|
||||||
execute_history: "Execute history",
|
execute_history: "Execute history",
|
||||||
debug_history: "Debug history",
|
debug_history: "Debug history",
|
||||||
|
testing: "Testing",
|
||||||
table: {
|
table: {
|
||||||
select_tip: "Item {0} data is selected"
|
select_tip: "Item {0} data is selected"
|
||||||
},
|
},
|
||||||
|
|
|
@ -171,6 +171,7 @@ export default {
|
||||||
executor: "执行人",
|
executor: "执行人",
|
||||||
execute_history: "执行历史",
|
execute_history: "执行历史",
|
||||||
debug_history: "调试历史",
|
debug_history: "调试历史",
|
||||||
|
testing: "测试中",
|
||||||
table: {
|
table: {
|
||||||
select_tip: "已选中 {0} 条数据"
|
select_tip: "已选中 {0} 条数据"
|
||||||
},
|
},
|
||||||
|
|
|
@ -171,6 +171,7 @@ export default {
|
||||||
executor: "執行人",
|
executor: "執行人",
|
||||||
execute_history: "執行歷史",
|
execute_history: "執行歷史",
|
||||||
debug_history: "調試歷史",
|
debug_history: "調試歷史",
|
||||||
|
testing: "測試中",
|
||||||
selector: {
|
selector: {
|
||||||
required: "必填",
|
required: "必填",
|
||||||
not_required: "非必填",
|
not_required: "非必填",
|
||||||
|
|
Loading…
Reference in New Issue