fix(测试跟踪): 测试计划执行结束时入库增加判断

--bug=1020347 --user=宋天阳 【接口测试】测试计划-失败停止-场景用例未执行状态显示的是waiting
https://www.tapd.cn/55049933/s/1306376
This commit is contained in:
song-tianyang 2022-11-28 15:02:14 +08:00 committed by 建国
parent 07fe8670dc
commit 61302f291c
1 changed files with 17 additions and 2 deletions

View File

@ -530,11 +530,26 @@ public class TestPlanReportService {
private void initTestPlanReportBaseCount(TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs reportContent) {
if(testPlanReport != null && reportContent != null){
TestPlanReportBuildResultDTO reportBuildResultDTO = testPlanService.buildPlanReport(testPlanReport, reportContent);
reportContent.setApiBaseCount(JSONObject.toJSONString(reportBuildResultDTO.getTestPlanSimpleReportDTO()));
reportContent.setPassRate(reportBuildResultDTO.getTestPlanSimpleReportDTO().getPassRate());
//如果场景报告中出现了 Waiting 或者 Running 则不保存
boolean isReportAllFinished = this.checkAllReportFinished(reportBuildResultDTO.getTestPlanSimpleReportDTO());
if(isReportAllFinished){
reportContent.setApiBaseCount(JSONObject.toJSONString(reportBuildResultDTO.getTestPlanSimpleReportDTO()));
reportContent.setPassRate(reportBuildResultDTO.getTestPlanSimpleReportDTO().getPassRate());
}
}
}
private boolean checkAllReportFinished(TestPlanSimpleReportDTO testPlanSimpleReportDTO) {
if(CollectionUtils.isNotEmpty(testPlanSimpleReportDTO.getScenarioAllCases())){
for (TestPlanFailureScenarioDTO dto: testPlanSimpleReportDTO.getScenarioAllCases()) {
if(StringUtils.equalsAnyIgnoreCase(dto.getLastResult(),"Waiting","Running")){
return false;
}
}
}
return true;
}
/**
* @param planReportId 测试计划报告ID
* @param resourceRunMode 资源的运行模式,triggerMode非Scedule可以为null