fix(接口测试): 修复多层事物控制器执行结果显示问题

--bug=1014984 --user=赵勇 [接口测试]github#15873]事务控制器下添加事务控制器,场景调试内层事务控制器下步骤调试一直测试中,测试报告显示未执行 https://www.tapd.cn/55049933/s/1207610
This commit is contained in:
fit2-zhao 2022-07-22 17:03:21 +08:00 committed by f2c-ci-robot[bot]
parent 94809f5059
commit 75ccfadae0
2 changed files with 34 additions and 26 deletions

View File

@ -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 => {
@ -367,6 +379,7 @@ export default {
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){
//valuestep
@ -375,6 +388,7 @@ export default {
tempMap.set(children[i].stepId, children[i])
}
}
//step
let arr = children.filter(m => {
return !tempMap.get(m.stepId);
@ -382,6 +396,7 @@ export default {
//
return m.value.startTime - n.value.startTime;
});
//arr() tempArr
for(let j = 0, i = 0; j < tempArr.length; j++){
if(!tempArr[j]){
@ -392,6 +407,7 @@ export default {
//
tempArr[j].index = j + 1;
}
//
item.children = tempArr;
}
@ -404,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));

View File

@ -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);