From 10131cc9a45f45bd3886099fd7ab24a5a734cb55 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Sun, 2 Apr 2023 00:12:10 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E4=B8=AD=E5=A6=82=E6=9E=9C=E6=9C=80=E5=90=8E?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E6=9C=AA=E6=89=A7=E8=A1=8C=E7=9A=84=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4=E5=9C=A8=E7=BB=84=E8=A3=85=E6=8A=A5=E5=91=8A=E6=97=B6?= =?UTF-8?q?=E4=BC=9A=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复接口测试报告中如果最后出现未执行的步骤在组装报告时会报错的问题 --- .../scenario/ApiScenarioReportStructureService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java index 52449e24dc..2e5d6ef7c0 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java @@ -401,7 +401,12 @@ public class ApiScenarioReportStructureService { for (StepTreeDTO unListDTO : mergeList) { int index = unListDTO.getIndex(); if (index > 0) { - list.add(index - 1, unListDTO); + if (list.size() < (index - 1)) { + list.add(unListDTO); + } else { + list.add(index - 1, unListDTO); + } + } } for (int index = 0; index < list.size(); index++) {