fix(接口自动化): 测试报告循环控制器层级显示问题修复

This commit is contained in:
fit2-zhao 2021-06-17 14:56:15 +08:00 committed by fit2-zhao
parent 0bec8af6c4
commit c2157e48d9
1 changed files with 20 additions and 18 deletions

View File

@ -257,7 +257,20 @@ public abstract class MsTestElement {
if (element.getParent() == null) { if (element.getParent() == null) {
return path; return path;
} }
if (MsTestElementConstants.LoopController.name().equals(element.getType())) {
MsLoopController loopController = (MsLoopController) element;
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.WHILE.name()) && loopController.getWhileController() != null) {
path = "While 循环" + DelimiterConstants.STEP_DELIMITER.toString() + "While 循环-" + "${MS_LOOP_CONTROLLER_CONFIG}";
}
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.FOREACH.name()) && loopController.getForEachController() != null) {
path = "ForEach 循环" + DelimiterConstants.STEP_DELIMITER.toString() + " ForEach 循环-" + "${MS_LOOP_CONTROLLER_CONFIG}";
}
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.LOOP_COUNT.name()) && loopController.getCountController() != null) {
path = "次数循环" + DelimiterConstants.STEP_DELIMITER.toString() + "次数循环-" + "${MS_LOOP_CONTROLLER_CONFIG}";
}
} else {
path = StringUtils.isEmpty(element.getName()) ? element.getType() : element.getName() + DelimiterConstants.STEP_DELIMITER.toString() + path; path = StringUtils.isEmpty(element.getName()) ? element.getType() : element.getName() + DelimiterConstants.STEP_DELIMITER.toString() + path;
}
return getFullPath(element.getParent(), path); return getFullPath(element.getParent(), path);
} }
@ -273,18 +286,7 @@ public abstract class MsTestElement {
protected String getParentName(MsTestElement parent) { protected String getParentName(MsTestElement parent) {
if (parent != null) { if (parent != null) {
if (MsTestElementConstants.LoopController.name().equals(parent.getType())) { if (MsTestElementConstants.TransactionController.name().equals(parent.getType())) {
MsLoopController loopController = (MsLoopController) parent;
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.WHILE.name()) && loopController.getWhileController() != null) {
return "While 循环-" + "${MS_LOOP_CONTROLLER_CONFIG}";
}
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.FOREACH.name()) && loopController.getForEachController() != null) {
return "ForEach 循环-" + "${MS_LOOP_CONTROLLER_CONFIG}";
}
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.LOOP_COUNT.name()) && loopController.getCountController() != null) {
return "次数循环-" + "${MS_LOOP_CONTROLLER_CONFIG}";
}
}else if(MsTestElementConstants.TransactionController.name().equals(parent.getType())){
MsTransactionController transactionController = (MsTransactionController) parent; MsTransactionController transactionController = (MsTransactionController) parent;
if (StringUtils.isNotEmpty(transactionController.getName())) { if (StringUtils.isNotEmpty(transactionController.getName())) {
return transactionController.getName(); return transactionController.getName();