From fe1f78918d24982b70a305fe014cb214c9babbd9 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 22 Jul 2022 17:03:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=9A=E5=B1=82=E4=BA=8B=E7=89=A9=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8=E6=89=A7=E8=A1=8C=E7=BB=93=E6=9E=9C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1014984 --user=赵勇 [接口测试]github#15873]事务控制器下添加事务控制器,场景调试内层事务控制器下步骤调试一直测试中,测试报告显示未执行 https://www.tapd.cn/55049933/s/1207610 --- .../automation/report/SysnApiReportDetail.vue | 106 +++++++++--------- .../automation/scenario/EditApiScenario.vue | 36 +++--- 2 files changed, 73 insertions(+), 69 deletions(-) diff --git a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue index f9c78ba859..15e74cb99e 100644 --- a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue @@ -5,28 +5,28 @@
+ :show-cancel-button="false" + :debug="debug" + :export-flag="exportFlag" + :report="report" + @reportExport="handleExport" + @reportSave="handleSave"/>
+ :content="content" + :totalTime="totalTime" + :report="report" + v-if="!loading"/>
@@ -36,11 +36,11 @@ @@ -69,11 +69,11 @@
@@ -184,6 +184,18 @@ export default { } return type; }, + margeTransaction(item, arr) { + arr.forEach(subItem => { + if (item.resId === subItem.resourceId) { + item.value = subItem; + item.testing = false; + item.debug = true; + } + if (subItem.subRequestResults && subItem.subRequestResults.length > 0) { + this.margeTransaction(item, subItem.subRequestResults); + } + }) + }, formatContent(hashTree, tree, fullPath, pid) { if (hashTree) { hashTree.forEach(item => { @@ -309,7 +321,7 @@ export default { this.initHeartBeat(); } this.messageWebSocket.onmessage = this.onMessage; - this.messageWebSocket.onerror = this.cleanHeartBeat; + this.messageWebSocket.onerror = this.cleanHeartBeat; }, getReport() { let url = "/api/scenario/report/get/" + this.reportId; @@ -325,16 +337,16 @@ export default { this.content.success = (this.content.total - this.content.error - this.content.errorCode - this.content.unExecute); this.totalTime = this.content.totalTime; this.resetLabel(this.content.steps); - if(this.report.reportType === "UI_INDEPENDENT"){ + if (this.report.reportType === "UI_INDEPENDENT") { this.tempResult = this.content.steps; //校对执行次序 - try{ + try { this.checkOrder(this.tempResult); this.fullTreeNodes = this.tempResult; - }catch(e){ + } catch (e) { this.fullTreeNodes = this.content.steps; } - }else{ + } else { this.fullTreeNodes = this.content.steps; } this.recursiveSorting(this.fullTreeNodes); @@ -345,31 +357,31 @@ export default { } }); }, - checkOrder(origin){ - if(!origin){ + checkOrder(origin) { + if (!origin) { return; } - if(Array.isArray(origin)){ + if (Array.isArray(origin)) { this.sortChildren(origin); origin.forEach(v => { - if(v.children){ + if (v.children) { this.checkOrder(v.children) } }) } }, - sortChildren(source){ - if(!source){ + sortChildren(source) { + if (!source) { return; } - source.forEach( item =>{ + source.forEach(item => { let children = item.children; - if(children && children.length > 0){ + if (children && children.length > 0) { let tempArr = new Array(children.length); let tempMap = new Map(); - for(let i = 0; i < children.length; i++){ - if(!children[i].value || !children[i].value.startTime || children[i].value.startTime === 0){ + for (let i = 0; i < children.length; i++) { + if (!children[i].value || !children[i].value.startTime || children[i].value.startTime === 0) { //若没有value或未执行的,则step留在当前位置 tempArr[i] = children[i]; //进行标识 @@ -386,8 +398,8 @@ export default { }); //找出arr(已经有序,从头取即可)中时间最小的插入 tempArr 可用位置 - for(let j = 0, i = 0; j < tempArr.length; j++){ - if(!tempArr[j]){ + for (let j = 0, i = 0; j < tempArr.length; j++) { + if (!tempArr[j]) { //占位 tempArr[j] = arr[i]; i++; @@ -408,13 +420,7 @@ export default { } else if (resourceId && resourceId.startsWith("result_")) { let data = JSON.parse(resourceId.substring(7)); if (data.method === 'Request' && data.subRequestResults && data.subRequestResults.length > 0) { - data.subRequestResults.forEach(subItem => { - if (item.resId === subItem.resourceId) { - item.value = subItem; - item.testing = false; - item.debug = true; - } - }) + this.margeTransaction(item, data.subRequestResults); } else if (item.resId === data.resourceId) { if (item.value && item.value.id && !item.mark) { let newItem = JSON.parse(JSON.stringify(item)); @@ -505,7 +511,7 @@ export default { } } }, - websocketKey(){ + websocketKey() { return "ui_ws_" + this.reportId; }, initHeartBeat() { diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 105741af3b..6a8c772507 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -932,21 +932,27 @@ export default { this.runningEditParent(node.parent); } }, + margeTransaction(item, console, arr) { + arr.forEach(sub => { + if (item.data && item.data.id + "_" + item.data.parentIndex === sub.resourceId) { + sub.responseResult.console = console; + item.data.requestResult.push(sub); + // 更新父节点状态 + this.resultEvaluation(sub.resourceId, sub.success); + item.data.testing = false; + item.data.debug = true; + } + if (sub.subRequestResults && sub.subRequestResults.length > 0) { + this.margeTransaction(item, console, sub.subRequestResults); + } + }) + }, runningNodeChild(arr, resultData) { arr.forEach(item => { if (resultData && resultData.startsWith("result_")) { let data = JSON.parse(resultData.substring(7)); if (data.method === 'Request' && data.subRequestResults && data.subRequestResults.length > 0) { - data.subRequestResults.forEach(subItem => { - if (item.data && item.data.id + "_" + item.data.parentIndex === subItem.resourceId) { - subItem.responseResult.console = data.responseResult.console; - item.data.requestResult.push(subItem); - // 更新父节点状态 - this.resultEvaluation(subItem.resourceId, subItem.success); - item.data.testing = false; - item.data.debug = true; - } - }) + this.margeTransaction(item, data.responseResult.console, data.subRequestResults); } else if ((item.data && item.data.id + "_" + item.data.parentIndex === data.resourceId) || (item.data && item.data.resourceId + "_" + item.data.parentIndex === data.resourceId)) { if (item.data.requestResult) { @@ -976,15 +982,7 @@ export default { } else if (resultData && resultData.startsWith("result_")) { let data = JSON.parse(resultData.substring(7)); if (data.method === 'Request' && data.subRequestResults && data.subRequestResults.length > 0) { - data.subRequestResults.forEach(subItem => { - if (item.data && item.data.id + "_" + item.data.parentIndex === subItem.resourceId) { - item.data.requestResult.push(subItem); - // 更新父节点状态 - this.resultEvaluation(subItem.resourceId, subItem.success); - item.data.testing = false; - item.data.debug = true; - } - }) + this.margeTransaction(item, data.responseResult.console, data.subRequestResults); } else if (item.data && item.data.id + "_" + item.data.parentIndex === data.resourceId || (item.data && item.data.resourceId + "_" + item.data.parentIndex === data.resourceId)) { item.data.requestResult.push(data);