fix(测试计划执行): 优化测试计划执行时的监听方法

优化测试计划执行时的监听方法,输出更多日志
This commit is contained in:
song-tianyang 2021-12-15 23:51:29 +08:00 committed by song-tianyang
parent a46696fd6a
commit 4dcdbce306
2 changed files with 15 additions and 8 deletions

View File

@ -243,10 +243,12 @@ public class TestPlanExecuteInfo {
public Map<String, String> getRunningApiCaseReportMap() { public Map<String, String> getRunningApiCaseReportMap() {
//key: reportId, value: testPlanApiCaseId //key: reportId, value: testPlanApiCaseId
Map<String, String> returnMap = new HashMap<>(); Map<String, String> returnMap = new HashMap<>();
for (String result : apiCaseExecInfo.keySet()) { for (Map.Entry<String,String> entry : apiCaseExecInfo.entrySet()) {
if (StringUtils.equalsIgnoreCase(result, TestPlanApiExecuteStatus.RUNNING.name())) { String planCaseId = entry.getKey();
if (apiCaseExecuteThreadMap.containsKey(result)) { String status = entry.getValue();
returnMap.put(apiCaseExecuteThreadMap.get(result), result); if (StringUtils.equalsIgnoreCase(status, TestPlanApiExecuteStatus.RUNNING.name())) {
if (apiCaseExecuteThreadMap.containsKey(planCaseId)) {
returnMap.put(apiCaseExecuteThreadMap.get(planCaseId), planCaseId);
} }
} }
} }
@ -256,10 +258,12 @@ public class TestPlanExecuteInfo {
public Map<String, String> getRunningScenarioReportMap() { public Map<String, String> getRunningScenarioReportMap() {
//key: reportId, value: testPlanApiScenarioId //key: reportId, value: testPlanApiScenarioId
Map<String, String> returnMap = new HashMap<>(); Map<String, String> returnMap = new HashMap<>();
for (String result : apiScenarioCaseExecInfo.keySet()) { for (Map.Entry<String,String> entry : apiScenarioCaseExecInfo.entrySet()) {
if (StringUtils.equalsIgnoreCase(result, TestPlanApiExecuteStatus.RUNNING.name())) { String planScenarioId = entry.getKey();
if (apiScenarioThreadMap.containsKey(result)) { String status = entry.getValue();
returnMap.put(apiScenarioThreadMap.get(result), result); if (StringUtils.equalsIgnoreCase(status, TestPlanApiExecuteStatus.RUNNING.name())) {
if (apiScenarioThreadMap.containsKey(planScenarioId)) {
returnMap.put(apiScenarioThreadMap.get(planScenarioId), planScenarioId);
} }
} }
} }

View File

@ -1312,7 +1312,10 @@ public class TestPlanReportService {
} }
} }
} }
testPlanLog.info("ReportID:"+planReportId+" 本次数据库同步,案例ID"+JSON.toJSONString(apiCaseReportMap.keySet())+";场景ID"+JSON.toJSONString(scenarioReportMap.keySet())+"; 同步结果,案例:"+JSON.toJSONString(updateCaseStatusMap)+";场景:"+JSON.toJSONString(updateScenarioStatusMap));
TestPlanReportExecuteCatch.updateApiTestPlanExecuteInfo(planReportId, updateCaseStatusMap, updateScenarioStatusMap, null); TestPlanReportExecuteCatch.updateApiTestPlanExecuteInfo(planReportId, updateCaseStatusMap, updateScenarioStatusMap, null);
}else {
testPlanLog.info("同步数据库查询执行信息失败! 报告ID在缓存中未找到"+planReportId);
} }
} }