fix(测试跟踪): 批量执行测试计划问题修复
--user=郭雨琦 修复批量执行测试计划串行只执行一个的问题(串行时调用运行接口查询队列的条件给错了,增加队列数据的sql语句少了一个属性的值) 修复批量执行串行不安选择的计划顺序执行 批量执行操作后校验不通过就不要弹出任务中心窗口
This commit is contained in:
parent
246c4951d3
commit
c131d0f108
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
public class ExtTestPlanExecutionQueueProvider {
|
||||
public String insertListSql(List<TestPlanExecutionQueue> list) {
|
||||
StringBuffer sqlList = new StringBuffer();
|
||||
sqlList.append("insert into test_plan_execution_queue (id,report_id, run_mode, create_time) values ");
|
||||
sqlList.append("insert into test_plan_execution_queue (id,report_id, run_mode, create_time, test_plan_id) values ");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TestPlanExecutionQueue result = list.get(i);
|
||||
sqlList.append(" (")
|
||||
|
@ -19,6 +19,8 @@ public class ExtTestPlanExecutionQueueProvider {
|
|||
.append(result.getRunMode())
|
||||
.append("','")
|
||||
.append(result.getCreateTime())
|
||||
.append("','")
|
||||
.append(result.getTestPlanId())
|
||||
.append("'")
|
||||
.append(")");
|
||||
if (i < list.size() - 1) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import io.metersphere.base.mapper.*;
|
|||
import io.metersphere.base.mapper.ext.*;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.constants.RunModeConstants;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.dto.TestPlanExecuteReportDTO;
|
||||
import io.metersphere.dto.UserDTO;
|
||||
|
@ -545,15 +546,15 @@ public class TestPlanReportService {
|
|||
testPlanExecutionQueueExample.createCriteria().andReportIdEqualTo(testPlanReportId);
|
||||
List<TestPlanExecutionQueue> planExecutionQueues = testPlanExecutionQueueMapper.selectByExample(testPlanExecutionQueueExample);
|
||||
String runMode=null;
|
||||
if(planExecutionQueues!=null&&planExecutionQueues.size()>0){
|
||||
if(CollectionUtils.isNotEmpty(planExecutionQueues)){
|
||||
runMode = planExecutionQueues.get(0).getRunMode();
|
||||
testPlanExecutionQueueMapper.deleteByExample(testPlanExecutionQueueExample);
|
||||
}
|
||||
if(runMode!=null&&StringUtils.equalsIgnoreCase(runMode,"serial")){
|
||||
if(runMode!=null&&StringUtils.equalsIgnoreCase(runMode, RunModeConstants.SERIAL.name())){
|
||||
TestPlanExecutionQueueExample queueExample = new TestPlanExecutionQueueExample();
|
||||
queueExample.createCriteria().andReportIdIsNotNull();
|
||||
List<TestPlanExecutionQueue> planExecutionQueueList = testPlanExecutionQueueMapper.selectByExample(testPlanExecutionQueueExample);
|
||||
if(planExecutionQueueList==null||planExecutionQueueList.size()==0){
|
||||
List<TestPlanExecutionQueue> planExecutionQueueList = testPlanExecutionQueueMapper.selectByExample(queueExample);
|
||||
if(CollectionUtils.isEmpty(planExecutionQueueList)){
|
||||
return testPlanReport;
|
||||
}
|
||||
TestPlanExecutionQueue testPlanExecutionQueue = planExecutionQueueList.get(0);
|
||||
|
|
|
@ -23,6 +23,7 @@ import io.metersphere.base.mapper.ext.*;
|
|||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.constants.RunModeConstants;
|
||||
import io.metersphere.dto.*;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.log.utils.ReflexObjectUtil;
|
||||
|
@ -954,7 +955,7 @@ public class TestPlanService {
|
|||
}
|
||||
if (runModeConfig == null) {
|
||||
runModeConfig = new RunModeConfigDTO();
|
||||
runModeConfig.setMode("serial");
|
||||
runModeConfig.setMode(RunModeConstants.SERIAL.name());
|
||||
runModeConfig.setReportType("iddReport");
|
||||
runModeConfig.setEnvMap(new HashMap<>());
|
||||
runModeConfig.setOnSampleError(false);
|
||||
|
@ -2074,7 +2075,8 @@ public class TestPlanService {
|
|||
List<MsExecResponseDTO> responseDTOS = new LinkedList<>();
|
||||
Map<String, TestPlanScheduleReportInfoDTO> planScheduleReportInfoDTOMap = new LinkedHashMap<>();
|
||||
boolean startThread = true;
|
||||
for (TestPlanWithBLOBs testPlan : planList) {
|
||||
for (String id : ids) {
|
||||
TestPlanWithBLOBs testPlan = testPlanMap.get(id);
|
||||
if(StringUtils.isBlank(testPlan.getRunModeConfig())){
|
||||
startThread = false;
|
||||
MSException.throwException("请保存["+testPlan.getName()+"]的运行配置");
|
||||
|
@ -2118,17 +2120,17 @@ public class TestPlanService {
|
|||
}
|
||||
|
||||
private void runByMode(boolean startThread, TestplanRunRequest request, Map<String, TestPlanWithBLOBs> testPlanMap, Map<String, TestPlanScheduleReportInfoDTO> planScheduleReportInfoDTOMap, List<TestPlanExecutionQueue> planExecutionQueues) {
|
||||
if (planExecutionQueues != null&& planExecutionQueues.size()>0) {
|
||||
if (CollectionUtils.isNotEmpty(planExecutionQueues)) {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Thread.currentThread().setName("TEST_PLAN_BATCH:" + System.currentTimeMillis());
|
||||
if(StringUtils.equalsIgnoreCase(request.getMode(),"serial")){
|
||||
if(StringUtils.equalsIgnoreCase(request.getMode(),RunModeConstants.SERIAL.name())){
|
||||
TestPlanExecutionQueue planExecutionQueue = planExecutionQueues.get(0);
|
||||
TestPlanWithBLOBs testPlan = testPlanMap.get(planExecutionQueue.getTestPlanId());
|
||||
JSONObject jsonObject = JSONObject.parseObject(testPlan.getRunModeConfig());
|
||||
TestplanRunRequest runRequest = JSON.toJavaObject(jsonObject,TestplanRunRequest.class);
|
||||
runRequest.setPlanScheduleReportInfoDTO(planScheduleReportInfoDTOMap.get(planExecutionQueue.getTestPlanId()));
|
||||
runRequest.setPlanScheduleReportInfoDTO(planScheduleReportInfoDTOMap.get(planExecutionQueue.getTestPlanId()));
|
||||
runPlan(runRequest);
|
||||
}else {
|
||||
for (TestPlanExecutionQueue planExecutionQueue : planExecutionQueues) {
|
||||
|
|
|
@ -639,8 +639,8 @@ export default {
|
|||
param.userId = getCurrentUserId();
|
||||
param.requestOriginator = "TEST_PLAN";
|
||||
param.testPlanIds = ids;
|
||||
this.$refs.taskCenter.open();
|
||||
this.result = this.$post('/test/plan/run/batch/', param, () => {
|
||||
this.$refs.taskCenter.open();
|
||||
this.$success(this.$t('commons.run_success'));
|
||||
}, error => {
|
||||
// this.$error(error.message);
|
||||
|
|
Loading…
Reference in New Issue