fix(接口自动化): 修复 BUG0609_1_P0-批量执行两个场景,其中一个步骤全禁用。批量执行选择并发的集合报告状态一直为Running

This commit is contained in:
fit2-zhao 2021-06-10 10:15:45 +08:00 committed by fit2-zhao
parent a50d7cec3b
commit 4c23051ffe
1 changed files with 30 additions and 0 deletions

View File

@ -434,7 +434,36 @@ public class ApiScenarioReportService {
}
}
private void counter(TestResult result) {
if (CollectionUtils.isEmpty(result.getScenarios())) {
if (StringUtils.isNotEmpty(result.getTestId())) {
List<String> list = new LinkedList<>();
try {
list = JSON.parseObject(result.getTestId(), List.class);
} catch (Exception e) {
list.add(result.getTestId());
}
ApiScenarioReportExample scenarioReportExample = new ApiScenarioReportExample();
scenarioReportExample.createCriteria().andIdIn(list);
List<ApiScenarioReport> reportList = apiScenarioReportMapper.selectByExample(scenarioReportExample);
for (ApiScenarioReport report : reportList) {
if (report.getExecuteType().equals(ExecuteType.Marge.name())) {
Object obj = MessageCache.cache.get(report.getScenarioId());
if (obj != null) {
ReportCounter counter = (ReportCounter) obj;
counter.setNumber(counter.getNumber() + 1);
MessageCache.cache.put(report.getScenarioId(), counter);
}
}
}
}
}
}
public ApiScenarioReport updateScenario(TestResult result) {
// 针对未正常返回结果的报告计数
counter(result);
ApiScenarioReport lastReport = null;
for (ScenarioResult item : result.getScenarios()) {
// 更新报告状态
@ -479,6 +508,7 @@ public class ApiScenarioReportService {
}
}
}
return lastReport;
}