perf(接口测试): 优化测试计划执行性能问题
--story=1006722 --user=赵勇 【测试跟踪】【国信问题】测试计划执行效率优化 https://www.tapd.cn/55049933/s/1126311
This commit is contained in:
parent
f8e2fee749
commit
8e1302f23b
|
@ -88,14 +88,14 @@ public class JMeterService {
|
|||
LoggerUtil.debug("监听MessageCache.tasks当前容量:" + FixedCapacityUtils.jmeterLogTask.size());
|
||||
if (request.isDebug() && !StringUtils.equalsAny(request.getRunMode(), ApiRunMode.DEFINITION.name())) {
|
||||
LoggerUtil.debug("为请求 [ " + request.getReportId() + " ] 添加同步接收结果 Listener");
|
||||
JMeterBase.addSyncListener(request, request.getHashTree(), APISingleResultListener.class.getCanonicalName());
|
||||
JMeterBase.addBackendListener(request, request.getHashTree(), APISingleResultListener.class.getCanonicalName());
|
||||
}
|
||||
if (request.isDebug()) {
|
||||
LoggerUtil.debug("为请求 [ " + request.getReportId() + " ] 添加Debug Listener");
|
||||
addDebugListener(request.getReportId(), request.getHashTree());
|
||||
} else {
|
||||
LoggerUtil.debug("为请求 [ " + request.getReportId() + " ] 添加同步接收结果 Listener");
|
||||
JMeterBase.addSyncListener(request, request.getHashTree(), APISingleResultListener.class.getCanonicalName());
|
||||
JMeterBase.addBackendListener(request, request.getHashTree(), APISingleResultListener.class.getCanonicalName());
|
||||
}
|
||||
|
||||
LocalRunner runner = new LocalRunner(request.getHashTree());
|
||||
|
|
|
@ -47,6 +47,13 @@ public class ApiScenarioReportResultService {
|
|||
|
||||
public void batchSave(List<ResultDTO> dtos) {
|
||||
if (CollectionUtils.isNotEmpty(dtos)) {
|
||||
if (dtos.size() == 1 && CollectionUtils.isNotEmpty(dtos.get(0).getRequestResults()) && dtos.get(0).getRequestResults().size() == 1) {
|
||||
// 单条储存
|
||||
RequestResult requestResult = dtos.get(0).getRequestResults().get(0);
|
||||
if (StringUtils.isEmpty(requestResult.getName()) || !requestResult.getName().startsWith("Transaction=") || !CollectionUtils.isEmpty(requestResult.getSubRequestResults())) {
|
||||
apiScenarioReportResultMapper.insert(this.newApiScenarioReportResult(dtos.get(0).getReportId(), requestResult));
|
||||
}
|
||||
} else {
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
ApiScenarioReportResultMapper batchMapper = sqlSession.getMapper(ApiScenarioReportResultMapper.class);
|
||||
for (ResultDTO dto : dtos) {
|
||||
|
@ -64,6 +71,7 @@ public class ApiScenarioReportResultService {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void uiSave(String reportId, List<RequestResult> queue) {
|
||||
if (CollectionUtils.isNotEmpty(queue)) {
|
||||
|
|
Loading…
Reference in New Issue