fix(误报库): 修复场景报告在启用误报库之后统计错误的问题

修复场景报告在启用误报库之后统计错误的问题
This commit is contained in:
song-tianyang 2022-01-22 13:46:54 +08:00 committed by song-tianyang
parent 7d35424cdc
commit 702c2f3cb3
3 changed files with 14 additions and 11 deletions

View File

@ -141,21 +141,24 @@ public class ApiScenarioReportStructureService {
}
private void scenarioCalculate(List<StepTreeDTO> dtoList, AtomicLong isError, AtomicLong isErrorReport) {
/**
* 判断场景步骤的执行状态
* 失败状态的优先级最高其次是误报
*/
for (StepTreeDTO step : dtoList) {
if (step.getValue() != null) {
if (StringUtils.isNotEmpty(step.getErrorCode())) {
isErrorReport.set(isErrorReport.longValue() + 1);
} else if (step.getValue().getError() > 0 || !step.getValue().isSuccess()) {
if (step.getValue().getError() > 0 || !step.getValue().isSuccess()) {
isError.set(isError.longValue() + 1);
} else if (StringUtils.isNotEmpty(step.getErrorCode())) {
isErrorReport.set(isErrorReport.longValue() + 1);
}
} else if (CollectionUtils.isNotEmpty(step.getChildren())) {
AtomicLong isChildrenError = new AtomicLong();
AtomicLong isChildrenErrorReport = new AtomicLong();
stepChildrenErrorCalculate(step.getChildren(), isChildrenError,isChildrenErrorReport);
stepChildrenErrorCalculate(step.getChildren(), isChildrenError, isChildrenErrorReport);
if (isChildrenError.longValue() > 0) {
isError.set(isError.longValue() + 1);
}
if(isChildrenErrorReport.longValue() > 0){
} else if (isChildrenErrorReport.longValue() > 0) {
isErrorReport.set(isErrorReport.longValue() + 1);
}
}
@ -309,12 +312,11 @@ public class ApiScenarioReportStructureService {
private void stepChildrenErrorCalculate(List<StepTreeDTO> dtoList, AtomicLong isError, AtomicLong isErrorReport) {
for (StepTreeDTO step : dtoList) {
if (step.getValue() != null && step.getValue().getError() > 0) {
if (StringUtils.isNotEmpty(step.getErrorCode())) {
isErrorReport.set(isErrorReport.longValue() + 1);
} else if (step.getValue().getError() > 0 || !step.getValue().isSuccess()) {
if (step.getValue().getError() > 0 || !step.getValue().isSuccess()) {
isError.set(isError.longValue() + 1);
} else if (StringUtils.isNotEmpty(step.getErrorCode())) {
isErrorReport.set(isErrorReport.longValue() + 1);
}
break;
} else if (CollectionUtils.isNotEmpty(step.getChildren())) {
stepChildrenErrorCalculate(step.getChildren(), isError, isErrorReport);
}

View File

@ -203,6 +203,7 @@ export default {
resultMap: new Map([
['success', this.$t('test_track.plan_view.execute_result') + '' + this.$t('test_track.plan_view.pass')],
['error', this.$t('test_track.plan_view.execute_result') + '' + this.$t('api_test.home_page.detail_card.execution_failed')],
['errorReportResult', this.$t('test_track.plan_view.execute_result') + '' + this.$t('error_report_library.option.name')],
['default', this.$t('test_track.plan_view.execute_result') + '' + this.$t('api_test.home_page.detail_card.unexecute')]
]),
isXpack: false,

@ -1 +1 @@
Subproject commit 698d472f1179db10843cd9dc1cdb1597137b045c
Subproject commit 17f49ace9d024526c9b7647cf9f1435ef7f58dd0