fix (测试跟踪): 修复测试计划串行执行问题

This commit is contained in:
fit2-zhao 2021-10-13 11:35:24 +08:00 committed by fit2-zhao
parent 76bf3d30dd
commit 761af315e1
2 changed files with 6 additions and 3 deletions

View File

@ -155,9 +155,9 @@ public class JMeterService {
if (baseInfo != null) { if (baseInfo != null) {
platformUrl = baseInfo.getUrl(); platformUrl = baseInfo.getUrl();
} }
platformUrl += "/api/jmeter/download?testId=" + testId + "&reportId=" + reportId + "&runMode=" + runMode; platformUrl += "/api/jmeter/download?testId=" + testId + "&reportId=" + reportId + "&runMode=" + runMode + "&testPlanScenarioId";
if (StringUtils.isNotEmpty(testPlanScenarioId)) { if (StringUtils.isNotEmpty(testPlanScenarioId)) {
platformUrl += "&testPlanScenarioId=" + testPlanScenarioId; platformUrl += "=" + testPlanScenarioId;
} }
runRequest.setUrl(platformUrl); runRequest.setUrl(platformUrl);
runRequest.setRunMode(runMode); runRequest.setRunMode(runMode);

View File

@ -37,6 +37,7 @@ public class SerialScenarioExecTask<T> implements Callable<T> {
MessageCache.terminationOrderDeque.remove(runModeDataDTO.getReport().getId()); MessageCache.terminationOrderDeque.remove(runModeDataDTO.getReport().getId());
return null; return null;
} }
String testId;
if (request.getConfig() != null && StringUtils.isNotBlank(request.getConfig().getResourcePoolId())) { if (request.getConfig() != null && StringUtils.isNotBlank(request.getConfig().getResourcePoolId())) {
String testPlanScenarioId = ""; String testPlanScenarioId = "";
if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(runModeDataDTO.getTestId())) { if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(runModeDataDTO.getTestId())) {
@ -44,11 +45,13 @@ public class SerialScenarioExecTask<T> implements Callable<T> {
} else { } else {
testPlanScenarioId = request.getPlanScenarioId(); testPlanScenarioId = request.getPlanScenarioId();
} }
testId = runModeDataDTO.getTestId();
jMeterService.runTest(runModeDataDTO.getTestId(), runModeDataDTO.getReport().getId(), request.getRunMode(), testPlanScenarioId, request.getConfig()); jMeterService.runTest(runModeDataDTO.getTestId(), runModeDataDTO.getReport().getId(), request.getRunMode(), testPlanScenarioId, request.getConfig());
} else { } else {
testId = runModeDataDTO.getReport().getId();
jMeterService.runLocal(runModeDataDTO.getReport().getId(), runModeDataDTO.getHashTree(), TriggerMode.BATCH.name().equals(request.getTriggerMode()) ? TriggerMode.BATCH.name() : request.getReportId(), request.getRunMode()); jMeterService.runLocal(runModeDataDTO.getReport().getId(), runModeDataDTO.getHashTree(), TriggerMode.BATCH.name().equals(request.getTriggerMode()) ? TriggerMode.BATCH.name() : request.getReportId(), request.getRunMode());
} }
while (MessageCache.executionQueue.containsKey(runModeDataDTO.getReport().getId())) { while (MessageCache.executionQueue.containsKey(testId)) {
long time = MessageCache.executionQueue.get(runModeDataDTO.getReport().getId()); long time = MessageCache.executionQueue.get(runModeDataDTO.getReport().getId());
long currentSecond = (System.currentTimeMillis() - time) / 1000 / 60; long currentSecond = (System.currentTimeMillis() - time) / 1000 / 60;
// 设置五分钟超时 // 设置五分钟超时