fix(接口定义): 修复批量执行接口用例结果未拿到问题
This commit is contained in:
parent
188b152e81
commit
4118f8c702
|
@ -61,15 +61,21 @@ public class ApiDefinitionExecResultService {
|
|||
if (CollectionUtils.isNotEmpty(result.getScenarios())) {
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
ApiDefinitionExecResultMapper definitionExecResultMapper = sqlSession.getMapper(ApiDefinitionExecResultMapper.class);
|
||||
final boolean[] isFirst = {true};
|
||||
result.getScenarios().forEach(scenarioResult -> {
|
||||
if (scenarioResult != null && CollectionUtils.isNotEmpty(scenarioResult.getRequestResults())) {
|
||||
scenarioResult.getRequestResults().forEach(item -> {
|
||||
ApiDefinitionExecResult saveResult = definitionExecResultMapper.selectByPrimaryKey(result.getTestId());
|
||||
item.getResponseResult().setConsole(result.getConsole());
|
||||
boolean saved = true;
|
||||
if (saveResult == null) {
|
||||
if (saveResult == null || scenarioResult.getRequestResults().size() > 1) {
|
||||
saveResult = new ApiDefinitionExecResult();
|
||||
if (isFirst[0]) {
|
||||
isFirst[0] = false;
|
||||
saveResult.setId(result.getTestId());
|
||||
} else {
|
||||
saveResult.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
saveResult.setActuator("LOCAL");
|
||||
saveResult.setName(item.getName());
|
||||
saveResult.setTriggerMode(triggerMode);
|
||||
|
|
Loading…
Reference in New Issue