feat(场景报告统计): 修复内含其它场景的接口场景报告内的统计错误
修复内含其它场景的接口场景报告内的统计错误
This commit is contained in:
parent
6c675e79b7
commit
b8d71cbe9f
|
@ -147,7 +147,15 @@ public class ApiScenarioReportStructureService {
|
||||||
isError.set(isError.longValue() + 1);
|
isError.set(isError.longValue() + 1);
|
||||||
}
|
}
|
||||||
} else if (CollectionUtils.isNotEmpty(step.getChildren())) {
|
} else if (CollectionUtils.isNotEmpty(step.getChildren())) {
|
||||||
scenarioCalculate(step.getChildren(), isError, isErrorReport);
|
AtomicLong isChildrenError = new AtomicLong();
|
||||||
|
AtomicLong isChildrenErrorReport = new AtomicLong();
|
||||||
|
stepChildrenErrorCalculate(step.getChildren(), isChildrenError,isChildrenErrorReport);
|
||||||
|
if (isChildrenError.longValue() > 0) {
|
||||||
|
isError.set(isError.longValue() + 1);
|
||||||
|
}
|
||||||
|
if(isChildrenErrorReport.longValue() > 0){
|
||||||
|
isErrorReport.set(isErrorReport.longValue() + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +190,6 @@ public class ApiScenarioReportStructureService {
|
||||||
private void calculateStep(List<StepTreeDTO> dtoList, AtomicLong stepError, AtomicLong stepTotal, AtomicLong stepErrorCode) {
|
private void calculateStep(List<StepTreeDTO> dtoList, AtomicLong stepError, AtomicLong stepTotal, AtomicLong stepErrorCode) {
|
||||||
for (StepTreeDTO step : dtoList) {
|
for (StepTreeDTO step : dtoList) {
|
||||||
// 失败结果数量
|
// 失败结果数量
|
||||||
// stepErrorCalculate(step.getChildren(), stepError);
|
|
||||||
scenarioCalculate(step.getChildren(), stepError, stepErrorCode);
|
scenarioCalculate(step.getChildren(), stepError, stepErrorCode);
|
||||||
if (CollectionUtils.isNotEmpty(step.getChildren())) {
|
if (CollectionUtils.isNotEmpty(step.getChildren())) {
|
||||||
stepTotal.set((stepTotal.longValue() + step.getChildren().size()));
|
stepTotal.set((stepTotal.longValue() + step.getChildren().size()));
|
||||||
|
@ -296,27 +303,17 @@ public class ApiScenarioReportStructureService {
|
||||||
return reportDTO;
|
return reportDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stepErrorCalculate(List<StepTreeDTO> dtoList, AtomicLong isError) {
|
private void stepChildrenErrorCalculate(List<StepTreeDTO> dtoList, AtomicLong isError, AtomicLong isErrorReport) {
|
||||||
for (StepTreeDTO step : dtoList) {
|
for (StepTreeDTO step : dtoList) {
|
||||||
if (step.getValue() != null && step.getValue().getError() > 0) {
|
if (step.getValue() != null && step.getValue().getError() > 0) {
|
||||||
isError.set(isError.longValue() + 1);
|
if (StringUtils.isNotEmpty(step.getErrorCode())) {
|
||||||
} else if (CollectionUtils.isNotEmpty(step.getChildren())) {
|
isErrorReport.set(isErrorReport.longValue() + 1);
|
||||||
AtomicLong isChildrenError = new AtomicLong();
|
} else if (step.getValue().getError() > 0) {
|
||||||
stepChildrenErrorCalculate(step.getChildren(), isChildrenError);
|
|
||||||
if (isChildrenError.longValue() > 0) {
|
|
||||||
isError.set(isError.longValue() + 1);
|
isError.set(isError.longValue() + 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stepChildrenErrorCalculate(List<StepTreeDTO> dtoList, AtomicLong isError) {
|
|
||||||
for (StepTreeDTO step : dtoList) {
|
|
||||||
if (step.getValue() != null && step.getValue().getError() > 0) {
|
|
||||||
isError.set(isError.longValue() + 1);
|
|
||||||
break;
|
break;
|
||||||
} else if (CollectionUtils.isNotEmpty(step.getChildren())) {
|
} else if (CollectionUtils.isNotEmpty(step.getChildren())) {
|
||||||
stepChildrenErrorCalculate(step.getChildren(), isError);
|
stepChildrenErrorCalculate(step.getChildren(), isError, isErrorReport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue