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

修复场景报告在启用误报库之后统计错误的问题
This commit is contained in:
song-tianyang 2022-01-22 13:33:40 +08:00 committed by fit2-zhao
parent 8d69345b2a
commit 9e6d3637fd
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 b8d7a91300b411662a3492b08a7ec88b29a05c3d
Subproject commit fc88eec58494a51c04dbc39ee1c7b956f1e16a12