fix(接口测试): 修复场景报告导出时误报信息为空的缺陷

--bug=1014516 --user=王孝刚 【接口测试】场景报告-查看详情-导出报告,中间的步骤统计没有误报
https://www.tapd.cn/55049933/s/1193718
This commit is contained in:
song-tianyang 2022-07-04 10:34:54 +08:00 committed by TIanyang
parent 7533d68578
commit 67b8b664ae
1 changed files with 4 additions and 3 deletions

View File

@ -280,6 +280,7 @@ public class ApiScenarioReportStructureService {
result = JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), RequestResult.class);
}
step.setValue(result);
step.setTotalStatus(reportResult.getStatus());
step.setErrorCode(reportResults.get(i).getErrorCode());
if (i > 0) {
dtoList.add(step);
@ -296,7 +297,7 @@ public class ApiScenarioReportStructureService {
dto.setValue(new RequestResultExpandDTO(dto.getLabel(), ExecuteResult.API_SUCCESS.getValue()));
} else if (dto.getValue() instanceof RequestResultExpandDTO && StringUtils.isNotEmpty(((RequestResultExpandDTO) dto.getValue()).getStatus())) {
dto.setTotalStatus(((RequestResultExpandDTO) dto.getValue()).getStatus());
} else if (dto.getValue() != null) {
} else if (dto.getValue() != null && StringUtils.isEmpty(dto.getTotalStatus())) {
if (dto.getValue().getError() > 0 || BooleanUtils.isNotTrue(dto.getValue().isSuccess())) {
dto.setTotalStatus(ExecuteResult.FAIL.getValue());
} else {
@ -383,8 +384,8 @@ public class ApiScenarioReportStructureService {
}
// 非正常执行结束的请求结果
List<StepTreeDTO> unList = dtoList.stream().filter(e -> e.getValue() != null
&& ((StringUtils.equalsIgnoreCase(e.getType(), "DubboSampler") && e.getValue().getStartTime() == 0)
|| StringUtils.equalsIgnoreCase(e.getTotalStatus(), ExecuteResult.UN_EXECUTE.toString())))
&& ((StringUtils.equalsIgnoreCase(e.getType(), "DubboSampler") && e.getValue().getStartTime() == 0)
|| StringUtils.equalsIgnoreCase(e.getTotalStatus(), ExecuteResult.UN_EXECUTE.toString())))
.collect(Collectors.toList());
// 有效数据按照时间排序