From 41c3b2338458e7ae89392e6fbc0937694d02445b Mon Sep 17 00:00:00 2001 From: zhangdahai112 Date: Mon, 1 Aug 2022 10:34:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(UI=20=E8=87=AA=E5=8A=A8=E5=8C=96):=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=EF=BC=8C?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=9F=A5=E7=9C=8Bui=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1015452 --user=张大海 【测试计划】导出测试报告,无法查看ui用例执行结果 https://www.tapd.cn/55049933/s/1215877 --- .../TestPlanReportContentWithBLOBs.java | 2 ++ .../mapper/TestPlanReportContentMapper.xml | 29 ++++++++++++++----- .../track/dto/TestPlanSimpleReportDTO.java | 1 + .../track/service/TestPlanReportService.java | 3 ++ .../track/service/TestPlanService.java | 12 ++++++++ 5 files changed, 40 insertions(+), 7 deletions(-) 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); }