refactor(接口测试): 修复接口测试报告中如果最后出现未执行的步骤在组装报告时会报错的问题

修复接口测试报告中如果最后出现未执行的步骤在组装报告时会报错的问题
This commit is contained in:
song-tianyang 2023-04-02 00:12:10 +08:00 committed by fit2-zhao
parent 60acf8f718
commit 10131cc9a4
1 changed files with 6 additions and 1 deletions

View File

@ -401,8 +401,13 @@ public class ApiScenarioReportStructureService {
for (StepTreeDTO unListDTO : mergeList) { for (StepTreeDTO unListDTO : mergeList) {
int index = unListDTO.getIndex(); int index = unListDTO.getIndex();
if (index > 0) { if (index > 0) {
if (list.size() < (index - 1)) {
list.add(unListDTO);
} else {
list.add(index - 1, unListDTO); list.add(index - 1, unListDTO);
} }
}
} }
for (int index = 0; index < list.size(); index++) { for (int index = 0; index < list.size(); index++) {
list.get(index).setIndex((index + 1)); list.get(index).setIndex((index + 1));