fix(接口测试): 修复执行未收到结果的报告状态处理
This commit is contained in:
parent
eb00835b8b
commit
058ce481fc
|
@ -107,8 +107,7 @@ public class ApiScenarioReportService {
|
||||||
example.createCriteria().andReportIdEqualTo(dto.getReportId());
|
example.createCriteria().andReportIdEqualTo(dto.getReportId());
|
||||||
List<ApiScenarioReportResult> requestResults = apiScenarioReportResultMapper.selectByExample(example);
|
List<ApiScenarioReportResult> requestResults = apiScenarioReportResultMapper.selectByExample(example);
|
||||||
|
|
||||||
ApiScenarioReport scenarioReport = null;
|
ApiScenarioReport scenarioReport;
|
||||||
if (CollectionUtils.isNotEmpty(requestResults)) {
|
|
||||||
if (StringUtils.equals(dto.getRunMode(), ApiRunMode.SCENARIO_PLAN.name())) {
|
if (StringUtils.equals(dto.getRunMode(), ApiRunMode.SCENARIO_PLAN.name())) {
|
||||||
scenarioReport = updatePlanCase(requestResults, dto);
|
scenarioReport = updatePlanCase(requestResults, dto);
|
||||||
} else if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
|
} else if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_SCENARIO_PLAN.name(), ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
|
||||||
|
@ -116,7 +115,6 @@ public class ApiScenarioReportService {
|
||||||
} else {
|
} else {
|
||||||
scenarioReport = updateScenario(requestResults, dto);
|
scenarioReport = updateScenario(requestResults, dto);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// 串行队列
|
// 串行队列
|
||||||
SerialBlockingQueueUtil.offer(dto, scenarioReport != null ? scenarioReport : SerialBlockingQueueUtil.END_SIGN);
|
SerialBlockingQueueUtil.offer(dto, scenarioReport != null ? scenarioReport : SerialBlockingQueueUtil.END_SIGN);
|
||||||
return scenarioReport;
|
return scenarioReport;
|
||||||
|
@ -270,7 +268,7 @@ public class ApiScenarioReportService {
|
||||||
apiScenarioMapper.updateByPrimaryKey(scenario);
|
apiScenarioMapper.updateByPrimaryKey(scenario);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), errorSize > 0 ? "Error" : "Success", dto.getRunMode());
|
ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), errorSize > 0 || requestResults.isEmpty() ? "Error" : "Success", dto.getRunMode());
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +280,7 @@ public class ApiScenarioReportService {
|
||||||
Map<String, String> planScenarioReportMap = new HashMap<>();
|
Map<String, String> planScenarioReportMap = new HashMap<>();
|
||||||
|
|
||||||
long errorSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), "Error")).count();
|
long errorSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), "Error")).count();
|
||||||
ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), errorSize > 0 ? "Error" : "Success", dto.getRunMode());
|
ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), errorSize > 0 || requestResults.isEmpty() ? "Error" : "Success", dto.getRunMode());
|
||||||
if (report != null) {
|
if (report != null) {
|
||||||
if (StringUtils.isNotEmpty(dto.getTestPlanReportId()) && !testPlanReportIdList.contains(dto.getTestPlanReportId())) {
|
if (StringUtils.isNotEmpty(dto.getTestPlanReportId()) && !testPlanReportIdList.contains(dto.getTestPlanReportId())) {
|
||||||
testPlanReportIdList.add(dto.getTestPlanReportId());
|
testPlanReportIdList.add(dto.getTestPlanReportId());
|
||||||
|
@ -360,7 +358,7 @@ public class ApiScenarioReportService {
|
||||||
public ApiScenarioReport updateScenario(List<ApiScenarioReportResult> requestResults, ResultDTO dto) {
|
public ApiScenarioReport updateScenario(List<ApiScenarioReportResult> requestResults, ResultDTO dto) {
|
||||||
long errorSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), "Error")).count();
|
long errorSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), "Error")).count();
|
||||||
// 更新报告状态
|
// 更新报告状态
|
||||||
ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), errorSize > 0 ? "Error" : "Success", dto.getRunMode());
|
ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), errorSize > 0 || requestResults.isEmpty() ? "Error" : "Success", dto.getRunMode());
|
||||||
// 更新场景状态
|
// 更新场景状态
|
||||||
ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(dto.getTestId());
|
ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(dto.getTestId());
|
||||||
if (scenario == null) {
|
if (scenario == null) {
|
||||||
|
|
Loading…
Reference in New Issue