mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-30 11:08:38 +08:00
fix(接口测试): 修复资源池执行用例未找到环境问题
--bug=1011608 --user=赵勇 【接口测试】-接口case批量执行20+cases-并行+集合报告-多个case不执行 https://www.tapd.cn/55049933/s/1124978
This commit is contained in:
parent
9347431e3c
commit
9d67ee3e1d
@ -9,9 +9,11 @@ import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.exec.queue.DBTestQueue;
|
||||
import io.metersphere.api.exec.scenario.ApiScenarioSerialService;
|
||||
import io.metersphere.api.exec.utils.ApiDefinitionExecResultUtil;
|
||||
import io.metersphere.api.service.*;
|
||||
import io.metersphere.api.service.ApiCaseResultService;
|
||||
import io.metersphere.api.service.ApiExecutionQueueService;
|
||||
import io.metersphere.api.service.ApiScenarioReportStructureService;
|
||||
import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiScenarioReportMapper;
|
||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
||||
import io.metersphere.base.mapper.TestPlanApiCaseMapper;
|
||||
import io.metersphere.base.mapper.TestPlanMapper;
|
||||
@ -58,10 +60,6 @@ public class ApiCaseExecuteService {
|
||||
@Resource
|
||||
private ApiCaseResultService apiCaseResultService;
|
||||
@Resource
|
||||
private ApiScenarioReportService apiScenarioReportService;
|
||||
@Resource
|
||||
private ApiScenarioReportMapper apiScenarioReportMapper;
|
||||
@Resource
|
||||
ApiScenarioReportStructureService apiScenarioReportStructureService;
|
||||
|
||||
/**
|
||||
|
@ -182,6 +182,7 @@ public class ApiScenarioSerialService {
|
||||
ResultDTO dto = new ResultDTO();
|
||||
BeanUtils.copyBean(dto, runRequest);
|
||||
CommonBeanFactory.getBean(ApiExecutionQueueService.class).queueNext(dto);
|
||||
LoggerUtil.error("生成JMX执行脚本失败:", ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ import io.metersphere.dto.JmeterRunRequestDTO;
|
||||
import io.metersphere.service.EnvironmentGroupProjectService;
|
||||
import io.metersphere.service.JarConfigService;
|
||||
import io.metersphere.service.PluginService;
|
||||
import io.metersphere.utils.LoggerUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -69,11 +71,23 @@ public class ApiJmeterFileService {
|
||||
scenario = apiScenarioMapper.selectByPrimaryKey(planApiScenario.getApiScenarioId());
|
||||
}
|
||||
}
|
||||
|
||||
ApiExecutionQueueDetail detail = executionQueueDetailMapper.selectByPrimaryKey(queueId);
|
||||
if (detail == null) {
|
||||
ApiExecutionQueueDetailExample example = new ApiExecutionQueueDetailExample();
|
||||
example.createCriteria().andReportIdEqualTo(reportId);
|
||||
List<ApiExecutionQueueDetail> list = executionQueueDetailMapper.selectByExampleWithBLOBs(example);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
detail = list.get(0);
|
||||
}
|
||||
}
|
||||
Map<String, String> envMap = new LinkedHashMap<>();
|
||||
if (detail != null && StringUtils.isNotEmpty(detail.getEvnMap())) {
|
||||
envMap = JSON.parseObject(detail.getEvnMap(), Map.class);
|
||||
}
|
||||
if (MapUtils.isEmpty(envMap)) {
|
||||
LoggerUtil.info("测试资源:【" + remoteTestId + "】未找到可执行的环境 >>>>>>> ");
|
||||
}
|
||||
HashTree hashTree = null;
|
||||
if (StringUtils.equalsAnyIgnoreCase(runMode, ApiRunMode.DEFINITION.name(), ApiRunMode.JENKINS_API_PLAN.name(), ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.MANUAL_PLAN.name())) {
|
||||
hashTree = apiScenarioSerialService.generateHashTree(remoteTestId, envMap, runRequest);
|
||||
@ -209,9 +223,9 @@ public class ApiJmeterFileService {
|
||||
if (multipartFiles != null && !multipartFiles.isEmpty()) {
|
||||
for (String k : multipartFiles.keySet()) {
|
||||
byte[] v = multipartFiles.get(k);
|
||||
if(k.startsWith(bodyFilePath)){
|
||||
files.put(StringUtils.substringAfter(k,bodyFilePath), v);
|
||||
}else {
|
||||
if (k.startsWith(bodyFilePath)) {
|
||||
files.put(StringUtils.substringAfter(k, bodyFilePath), v);
|
||||
} else {
|
||||
LogUtil.error("WARNING:Attachment path is not in body_file_path: " + k);
|
||||
files.put(k, v);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user