mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-02 12:09:13 +08:00
fix(测试计划): 计划组报告执行状态有误
This commit is contained in:
parent
18d44b6f92
commit
5b3a0040e2
@ -21,6 +21,7 @@
|
||||
|
||||
<select id="getGroupExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiCase">
|
||||
select tpac.id as testPlanApiCaseId, atc.id as apiCaseId, atc.num as apiCaseNum, atc.name as apiCaseName, atc.priority as apiCasePriority,
|
||||
tpac.test_plan_collection_id testPlanCollectionId, tpac.environment_id as environmentId,
|
||||
if(ad.module_id = 'root','未规划用例', ad.module_id) as apiCaseModule, tpac.execute_user as apiCaseExecuteUser,
|
||||
ifnull(tpac.last_exec_result, 'PENDING') as apiCaseExecuteResult, tpac.last_exec_report_id apiCaseExecuteReportId, tpac.pos pos
|
||||
from test_plan_api_case tpac join api_test_case atc on atc.id = tpac.api_case_id
|
||||
|
@ -475,8 +475,15 @@ public class TestPlanReportService {
|
||||
CaseCount summaryCount = JSON.parseObject(new String(reportSummary.getExecuteResult()), CaseCount.class);
|
||||
planReport.setExecuteRate(RateCalculateUtils.divWithPrecision(((int) caseTotal - summaryCount.getPending()), (int) caseTotal, 2));
|
||||
planReport.setPassRate(RateCalculateUtils.divWithPrecision(summaryCount.getSuccess(), (int) caseTotal, 2));
|
||||
// 计划的(执行)结果状态: 通过率 >= 阈值 ? 成功 : 失败
|
||||
planReport.setResultStatus(planReport.getPassRate() >= planReport.getPassThreshold() ? ReportStatus.SUCCESS.name() : ReportStatus.ERROR.name());
|
||||
if (planReport.getIntegrated()) {
|
||||
// 计划组的(执行)结果状态: 子计划全部成功 ? 成功 : 失败
|
||||
TestPlanReportExample reportExample = new TestPlanReportExample();
|
||||
reportExample.createCriteria().andParentIdEqualTo(postParam.getReportId()).andIntegratedEqualTo(false).andResultStatusNotEqualTo(ReportStatus.SUCCESS.name());
|
||||
planReport.setResultStatus(testPlanReportMapper.countByExample(reportExample) == 0 ? ReportStatus.SUCCESS.name() : ReportStatus.ERROR.name());
|
||||
} else {
|
||||
// 计划的(执行)结果状态: 通过率 >= 阈值 ? 成功 : 失败
|
||||
planReport.setResultStatus(planReport.getPassRate() >= planReport.getPassThreshold() ? ReportStatus.SUCCESS.name() : ReportStatus.ERROR.name());
|
||||
}
|
||||
|
||||
testPlanReportMapper.updateByPrimaryKeySelective(planReport);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user