fix(接口自动化): #1006462 修复1.13版本中事务控制器下的层级结构不正确的bug

【【github#6014】使用两层事务控制器,内层事务控制器下复制或引用的场景在报告中查看不了具体内容】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001006462
This commit is contained in:
song-tianyang 2021-09-24 16:13:07 +08:00 committed by song-tianyang
parent a5605230c7
commit cb4b7ec032
3 changed files with 30 additions and 83 deletions

View File

@ -121,9 +121,9 @@ public class TestResult {
if (StringUtils.isNotEmpty(item.getName()) && item.getName().indexOf(SEPARATOR) != -1) {
String array[] = item.getName().split(SEPARATOR);
item.setName(array[1] + array[0]);
item.getSubRequestResults().forEach(subItem -> {
subItem.setName(array[0]);
});
// item.getSubRequestResults().forEach(subItem -> {
// subItem.setName(array[0]);
// });
} else {
this.genScenarioInSubRequestResult(item);
}

View File

@ -157,16 +157,15 @@ export default {
label: nodeArray[i],
value: item,
};
if (i !== nodeArray.length) {
if (i !== (nodeArray.length -1)) {
node.children = [];
}
if(item.subRequestResults && item.subRequestResults.length > 0){
let itemChildren = this.deepFormatTreeNode(item.subRequestResults);
node.children = itemChildren;
if (node.label.indexOf("UUID=")) {
node.label = node.label.split("UUID=")[0];
}else {
if(item.subRequestResults && item.subRequestResults.length > 0){
let itemChildren = this.deepFormatTreeNode(item.subRequestResults);
node.children = itemChildren;
if (node.label.indexOf("UUID=")) {
node.label = node.label.split("UUID=")[0];
}
}
}
if (children.length === 0) {
@ -225,10 +224,11 @@ export default {
},
deepFormatTreeNode(array) {
let children = [];
let returnChildren = [];
array.map((item) => {
let key = item.name;
let nodeArray = key.split('^@~@^');
let children = [];
let key = item.name.split('^@~@^')[0];
let nodeArray = key.split('<->');
//1
//hashTreeID
let scenarioId = "";
@ -242,75 +242,22 @@ export default {
}
}
//
for (let i = 0; i < nodeArray.length; i++) {
if (!nodeArray[i]) {
continue;
}
let node = {
label: nodeArray[i],
value: item,
};
if (i !== nodeArray.length) {
node.children = [];
}
if(item.subRequestResults && item.subRequestResults.length > 0){
let itemChildren = this.deepFormatTreeNode(item.subRequestResults);
node.children = itemChildren;
}
if (children.length === 0) {
children.push(node);
}
let isExist = false;
for (let j in children) {
if (children[j].label === node.label) {
let idIsPath = true;
//ID
//
if (i === nodeArray.length - 2) {
idIsPath = false;
let childId = "";
let childName = "";
if (children[j].value && children[j].value.scenario) {
let scenarioArr = JSON.parse(children[j].value.scenario);
if (scenarioArr.length > 1) {
let childArr = scenarioArr[0].split("_");
childId = childArr[0];
if (childArr.length > 1) {
childName = childArr[1];
}
}
}
if (scenarioId === "") {
idIsPath = true;
} else if (scenarioId === childId) {
idIsPath = true;
} else if (scenarioName !== childName) {
//ID
idIsPath = true;
}
}
if (idIsPath) {
if (i !== nodeArray.length - 1 && !children[j].children) {
children[j].children = [];
}
children = (i === nodeArray.length - 1 ? children : children[j].children);
isExist = true;
break;
}
}
}
if (!isExist) {
children.push(node);
if (i !== nodeArray.length - 1 && !children[children.length - 1].children) {
children[children.length - 1].children = [];
}
children = (i === nodeArray.length - 1 ? children : children[children.length - 1].children);
}
let node = {
label: nodeArray[0],
value: item,
children: []
};
if(item.subRequestResults && item.subRequestResults.length > 0){
let itemChildren = this.deepFormatTreeNode(item.subRequestResults);
node.children = itemChildren;
}
children.push(node);
children.forEach(itemNode => {
returnChildren.push(itemNode);
});
});
return children;
return returnChildren;
},
recursiveSorting(arr) {
for (let i in arr) {

View File

@ -270,7 +270,7 @@ export default {
this.reqTotal++;
let key = subItem.resourceId;
if (resMap.get(key)) {
if (resMap.get(key).indexOf(subItem) === -1) {
if (resMap.get(key).indexOf(subItem) === -1 && subItem.method !== 'Request') {
resMap.get(key).push(subItem);
}
} else {