fix(测试计划): 修复聚合报告一键总结问题

This commit is contained in:
song-cc-rock 2024-06-15 16:17:38 +08:00 committed by Craftsman
parent 36504c28cc
commit 062d4536bd
4 changed files with 41 additions and 1 deletions

View File

@ -39,9 +39,24 @@ public class TestPlanReportDetailResponse {
@Schema(description = "计划总数")
private Integer planCount;
/**
* 一键总结参数
*/
@Schema(description = "通过的计划数量 - 计划组报告使用")
private Integer passCountOfPlan = 0;
@Schema(description = "未通过的计划数量 - 计划组报告使用")
private Integer failCountOfPlan = 0;
@Schema(description = "功能用例明细的缺陷数量")
private Integer functionalBugCount = 0;
@Schema(description = "功能用例明细的缺陷数量")
private Integer apiBugCount = 0;
@Schema(description = "功能用例明细的缺陷数量")
private Integer scenarioBugCount = 0;
@Schema(description = "用例总数")
private Integer caseTotal = 0;
/**
* 执行分析
*/
@ -63,6 +78,7 @@ public class TestPlanReportDetailResponse {
@Schema(description = "接口场景用例分析-用例数")
private CaseCount apiScenarioCount;
@Schema(description = "报告是否删除")
private boolean deleted;
@Schema(description = "报告状态")

View File

@ -60,4 +60,11 @@ public interface ExtTestPlanReportFunctionalCaseMapper {
* @return 关联的用例集合
*/
List<ReportDetailCasePageDTO> list(@Param("request") TestPlanReportDetailPageRequest request);
/**
* 统计用例明细的关联缺陷数
* @param reportId 报告ID
* @return 缺陷数量
*/
Long countBug(@Param("id") String reportId);
}

View File

@ -68,6 +68,11 @@
<include refid="filter"/>
</select>
<select id="countBug" resultType="java.lang.Long">
select sum(function_case_bug_count) from test_plan_report_function_case tprfc
where tprfc.test_plan_report_id = #{id}
</select>
<sql id="filter">
<if test="request.filter != null and request.filter.size() > 0">
<foreach collection="request.filter.entrySet()" index="key" item="values">

View File

@ -482,7 +482,19 @@ public class TestPlanReportService {
int caseTotal = (int) (reportSummary.getFunctionalCaseCount() + reportSummary.getApiCaseCount() + reportSummary.getApiScenarioCount());
planReportDetail.setCaseTotal(caseTotal);
planReportDetail.setBugCount(reportSummary.getBugCount().intValue());
// 暂时只有功能用例能关联缺陷
Long functionalBugCount = extTestPlanReportFunctionalCaseMapper.countBug(reportId);
planReportDetail.setFunctionalBugCount(functionalBugCount.intValue());
if (planReport.getIntegrated()) {
// 计划组报告, 需要统计计划的执行数据
planReportDetail.setPlanCount(reportSummary.getPlanCount().intValue());
TestPlanReportExample reportExample = new TestPlanReportExample();
reportExample.createCriteria().andParentIdEqualTo(reportId);
List<TestPlanReport> testPlanReports = testPlanReportMapper.selectByExample(reportExample);
long planPassCount = testPlanReports.stream().filter(report -> StringUtils.equals(ExecStatus.SUCCESS.name(), report.getResultStatus())).count();
planReportDetail.setPassCountOfPlan((int) planPassCount);
planReportDetail.setFailCountOfPlan(planReportDetail.getPlanCount() - planReportDetail.getPassCountOfPlan());
}
planReportDetail.setSummary(reportSummary.getSummary());
/*
* 统计用例执行数据