diff --git a/backend/src/main/java/io/metersphere/base/domain/TestPlanReportContentWithBLOBs.java b/backend/src/main/java/io/metersphere/base/domain/TestPlanReportContentWithBLOBs.java index c80e0a7e22..fc8b582b2b 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestPlanReportContentWithBLOBs.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestPlanReportContentWithBLOBs.java @@ -59,5 +59,7 @@ public class TestPlanReportContentWithBLOBs extends TestPlanReportContent implem private String uiAllCases; + private String uiFailureCases; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestPlanReportContentMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestPlanReportContentMapper.xml index 56ec83af93..e3ab312254 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestPlanReportContentMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestPlanReportContentMapper.xml @@ -37,6 +37,7 @@ + @@ -106,7 +107,7 @@ load_all_Cases, load_failure_cases, plan_scenario_report_struct, plan_api_case_report_struct, plan_load_case_report_struct, error_report_cases, error_report_scenarios, un_execute_cases, un_execute_scenarios, plan_ui_scenario_report_struct, ui_result, api_base_count, - ui_all_cases + ui_all_cases, ui_failure_cases @@ -499,6 +506,9 @@ ui_all_cases = #{record.uiAllCases,jdbcType=LONGVARCHAR}, + + ui_failure_cases = #{record.uiFailureCases,jdbcType=LONGVARCHAR}, + @@ -538,7 +548,8 @@ plan_ui_scenario_report_struct = #{record.planUiScenarioReportStruct,jdbcType=LONGVARCHAR}, ui_result = #{record.uiResult,jdbcType=LONGVARCHAR}, api_base_count = #{record.apiBaseCount,jdbcType=LONGVARCHAR}, - ui_all_cases = #{record.uiAllCases,jdbcType=LONGVARCHAR} + ui_all_cases = #{record.uiAllCases,jdbcType=LONGVARCHAR}, + ui_failure_cases = #{record.uiFailureCases,jdbcType=LONGVARCHAR} @@ -656,6 +667,9 @@ ui_all_cases = #{uiAllCases,jdbcType=LONGVARCHAR}, + + ui_failure_cases = #{uiFailureCases,jdbcType=LONGVARCHAR}, + where id = #{id,jdbcType=VARCHAR} @@ -692,7 +706,8 @@ plan_ui_scenario_report_struct = #{planUiScenarioReportStruct,jdbcType=LONGVARCHAR}, ui_result = #{uiResult,jdbcType=LONGVARCHAR}, api_base_count = #{apiBaseCount,jdbcType=LONGVARCHAR}, - ui_all_cases = #{uiAllCases,jdbcType=LONGVARCHAR} + ui_all_cases = #{uiAllCases,jdbcType=LONGVARCHAR}, + ui_failure_cases = #{uiFailureCases,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} diff --git a/backend/src/main/java/io/metersphere/track/dto/TestPlanSimpleReportDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestPlanSimpleReportDTO.java index 2435917bea..c59055462c 100644 --- a/backend/src/main/java/io/metersphere/track/dto/TestPlanSimpleReportDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/TestPlanSimpleReportDTO.java @@ -59,4 +59,5 @@ public class TestPlanSimpleReportDTO extends TestPlanReportContent { List unExecuteScenarios; List uiAllCases; + List uiFailureCases; } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java index 96c1463a90..c5bb9eb498 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java @@ -979,6 +979,9 @@ public class TestPlanReportService { if (StringUtils.isNotBlank(testPlanReportContent.getUiAllCases())) { testPlanReportDTO.setUiAllCases(JSONObject.parseArray(testPlanReportContent.getUiAllCases(), TestPlanUiScenarioDTO.class)); } + if (StringUtils.isNotBlank(testPlanReportContent.getUiFailureCases())) { + testPlanReportDTO.setUiFailureCases(JSONObject.parseArray(testPlanReportContent.getUiFailureCases(), TestPlanUiScenarioDTO.class)); + } testPlanReportDTO.setId(reportId); TestPlanReport testPlanReport = testPlanReportMapper.selectByPrimaryKey(testPlanReportContent.getTestPlanReportId()); testPlanReportDTO.setName(testPlanReport.getName()); diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 58a8d6d76e..acb8e5a5be 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -1422,6 +1422,17 @@ public class TestPlanService { if (saveResponse) { buildUiScenarioResponse(allCases); } + + if (checkReportConfig(config, "ui", "failure")) { + List failureCases = null; + if (!CollectionUtils.isEmpty(allCases)) { + failureCases = allCases.stream() + .filter(i -> StringUtils.isNotBlank(i.getStatus()) + && StringUtils.equalsAnyIgnoreCase(i.getStatus(), "Error")) + .collect(Collectors.toList()); + } + report.setUiFailureCases(failureCases); + } } } } @@ -1886,6 +1897,7 @@ public class TestPlanService { buildScenarioResponse(report.getScenarioAllCases()); buildScenarioResponse(report.getScenarioFailureCases()); buildLoadResponse(report.getLoadAllCases()); + buildUiScenarioResponse(report.getUiAllCases()); report.setLang(lang); render(report, response); }