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