refactor(接口测试): 优化报告获取步骤数

This commit is contained in:
wxg0103 2024-03-26 11:32:32 +08:00 committed by 刘瑞斌
parent a4726a03ef
commit d6a0932361
4 changed files with 6 additions and 0 deletions

View File

@ -18,5 +18,7 @@ public class ApiReportDTO extends ApiReport {
private String environmentName;
@Schema(description = "创建人")
private String creatUserName;
@Schema(description = "步骤总数")
private Long total;
}

View File

@ -20,5 +20,7 @@ public class ApiScenarioReportDTO extends ApiScenarioReport {
private String environmentName;
@Schema(description = "创建人")
private String creatUserName;
@Schema(description = "请求总数")
private Long requestTotal;
}

View File

@ -177,6 +177,7 @@ public class ApiReportService {
ApiReport apiReport = checkResource(id);
BeanUtils.copyBean(apiReportDTO, apiReport);
//查询console
apiReportDTO.setTotal(apiReportDTO.getErrorCount() + apiReportDTO.getSuccessCount() + apiReportDTO.getPendingCount() + apiReportDTO.getFakeErrorCount());
ApiReportLogExample consoleExample = new ApiReportLogExample();
consoleExample.createCriteria().andReportIdEqualTo(id);
List<ApiReportLog> apiReportLogs = apiReportLogMapper.selectByExampleWithBLOBs(consoleExample);

View File

@ -189,6 +189,7 @@ public class ApiScenarioReportService {
steps.sort(Comparator.comparingLong(ApiScenarioReportStepDTO::getSort));
getStepTree(steps, scenarioReportStepMap);
scenarioReportDTO.setStepTotal(steps.size());
scenarioReportDTO.setRequestTotal(scenarioReportDTO.getErrorCount() + scenarioReportDTO.getPendingCount() + scenarioReportDTO.getSuccessCount() + scenarioReportDTO.getFakeErrorCount());
scenarioReportDTO.setChildren(steps);
//控制台信息 console
ApiScenarioReportLogExample example = new ApiScenarioReportLogExample();