revert: 回退"修复测试计划获取没有步骤结果场景时不会处理报告记录的问题"相关修改 (#8592)

* Revert "fix(测试计划): 修复测试计划获取没有步骤结果场景时不会处理报告记录的问题"

This reverts commit 08e27d3cc8.

* Revert "fix(测试计划): 修复测试计划获取没有步骤结果场景时不会处理报告记录的问题"

This reverts commit 75e678fc87.
This commit is contained in:
BugKing 2021-12-18 15:05:44 +08:00 committed by GitHub
parent 08e27d3cc8
commit 47617eea2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 25 deletions

View File

@ -1481,7 +1481,7 @@ public class ApiAutomationService {
String testId = executeQueue.get(reportId).getTestId();
if (request.getScenarioTestPlanIdMap() != null && request.getScenarioTestPlanIdMap().containsKey(executeQueue.get(reportId).getTestId())) {
testPlanScenarioId = executeQueue.get(reportId).getTestId();
testId = reportId;
testId = request.getScenarioTestPlanIdMap().get(executeQueue.get(reportId).getTestId());
} else {
testPlanScenarioId = request.getPlanScenarioId();
}

View File

@ -292,13 +292,14 @@ public class ApiScenarioReportService {
scenario.setExecuteTimes(executeTimes + 1);
apiScenarioMapper.updateByPrimaryKey(scenario);
// 发送通知
// sendNotice(scenario);
}
}
returnReport = report;
reportIds.add(report.getId());
MessageCache.executionQueue.remove(report.getId());
}
counterPlanScenarioReport(result);
return returnReport;
}
@ -425,8 +426,6 @@ public class ApiScenarioReportService {
LogUtil.error("未获取到场景报告。 报告ID" + scenarioResult.getName() + "。 步骤信息:" + JSON.toJSONString(scenarioResult));
}
}
// 针对未正常返回结果的报告计数
counterPlanScenarioReport(result);
testPlanLog.info("TestPlanReportId" + JSONArray.toJSONString(testPlanReportIdList) + " EXECUTE OVER. SCENARIO STATUS : " + JSONObject.toJSONString(scenarioAndErrorMap));
for (String reportId : testPlanReportIdList) {
TestPlanReportExecuteCatch.updateApiTestPlanExecuteInfo(reportId, null, scenarioAndErrorMap, null);
@ -578,26 +577,6 @@ public class ApiScenarioReportService {
}
}
private void counterPlanScenarioReport(TestResult result) {
if (CollectionUtils.isEmpty(result.getScenarios()) && StringUtils.isNotEmpty(result.getTestId())) {
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(result.getTestId());
if (report != null) {
report.setStatus("Error");
apiScenarioReportMapper.updateByPrimaryKey(report);
MessageCache.scenarioExecResourceLock.remove(report.getId());
MessageCache.executionQueue.remove(report.getId());
if (StringUtils.equals(report.getExecuteType(), ExecuteType.Marge.name()) || StringUtils.equals(report.getScenarioId(), result.getSetReportId())) {
Object obj = MessageCache.cache.get(result.getSetReportId());
if (obj != null) {
ReportCounter counter = (ReportCounter) obj;
counter.getCompletedIds().add(report.getId());
MessageCache.cache.put(result.getSetReportId(), counter);
}
}
}
}
}
public ApiScenarioReport updateScenario(TestResult result) {
ApiScenarioReport lastReport = null;
for (ScenarioResult item : result.getScenarios()) {

View File

@ -52,7 +52,7 @@ public class SerialScenarioExecTask<T> implements Callable<T> {
}else {
reportId = runModeDataDTO.getTestId();
}
jMeterService.runTest(runModeDataDTO.getReport().getId(), reportId, request.getRunMode(), testPlanScenarioId, request.getConfig());
jMeterService.runTest(runModeDataDTO.getTestId(), reportId, request.getRunMode(), testPlanScenarioId, request.getConfig());
} else {
reportId = runModeDataDTO.getReport().getId();
jMeterService.runLocal(runModeDataDTO.getReport().getId(),request.getConfig(), runModeDataDTO.getHashTree(), TriggerMode.BATCH.name().equals(request.getTriggerMode()) ? TriggerMode.BATCH.name() : request.getReportId(), request.getRunMode());