parent
bcca8cae07
commit
118575abb9
|
@ -215,6 +215,12 @@ public class TestPlanController {
|
||||||
return testPlanService.runPlan(testplanRunRequest);
|
return testPlanService.runPlan(testplanRunRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/run/save")
|
||||||
|
public String runAndSave(@RequestBody TestPlanRunRequest testplanRunRequest) {
|
||||||
|
testPlanService.updateRunModeConfig(testplanRunRequest);
|
||||||
|
return testPlanService.runPlan(testplanRunRequest);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/run/batch")
|
@PostMapping(value = "/run/batch")
|
||||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_PLAN, type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.testPlanIds)", msClass = TestPlanService.class)
|
@MsAuditLog(module = OperLogModule.TRACK_TEST_PLAN, type = OperLogConstants.EXECUTE, content = "#msClass.getLogDetails(#request.testPlanIds)", msClass = TestPlanService.class)
|
||||||
public void runBatch(@RequestBody TestPlanRunRequest request) {
|
public void runBatch(@RequestBody TestPlanRunRequest request) {
|
||||||
|
|
|
@ -975,30 +975,27 @@ public class TestPlanService {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
if (runModeConfig == null) {
|
if (runModeConfig == null) {
|
||||||
|
runModeConfig = buildRunModeConfigDTO();
|
||||||
|
}
|
||||||
|
|
||||||
|
//环境参数为空时,依据测试计划保存的环境执行
|
||||||
|
if ((StringUtils.equals("GROUP", runModeConfig.getEnvironmentType()) && StringUtils.isBlank(runModeConfig.getEnvironmentGroupId()))
|
||||||
|
|| (!StringUtils.equals("GROUP", runModeConfig.getEnvironmentType()) && MapUtils.isEmpty(runModeConfig.getEnvMap()))) {
|
||||||
TestPlanWithBLOBs testPlanWithBLOBs = testPlanMapper.selectByPrimaryKey(testPlanID);
|
TestPlanWithBLOBs testPlanWithBLOBs = testPlanMapper.selectByPrimaryKey(testPlanID);
|
||||||
if (StringUtils.isNotEmpty(testPlanWithBLOBs.getRunModeConfig())) {
|
if (StringUtils.isNotEmpty(testPlanWithBLOBs.getRunModeConfig())) {
|
||||||
|
try {
|
||||||
JSONObject json = JSONObject.parseObject(testPlanWithBLOBs.getRunModeConfig());
|
JSONObject json = JSONObject.parseObject(testPlanWithBLOBs.getRunModeConfig());
|
||||||
TestPlanRequestUtil.changeStringToBoolean(json);
|
TestPlanRequestUtil.changeStringToBoolean(json);
|
||||||
TestPlanRunRequest testPlanRunRequest = JSON.toJavaObject(json, TestPlanRunRequest.class);
|
TestPlanRunRequest testPlanRunRequest = JSON.toJavaObject(json, TestPlanRunRequest.class);
|
||||||
if (StringUtils.equals("GROUP", testPlanRunRequest.getEnvironmentType()) && StringUtils.isBlank(testPlanRunRequest.getEnvironmentGroupId())) {
|
if (testPlanRunRequest != null) {
|
||||||
runModeConfig = buildRunModeConfigDTO();
|
String envType = testPlanRunRequest.getEnvironmentType();
|
||||||
} else {
|
Map<String, String> envMap = testPlanRunRequest.getEnvMap();
|
||||||
runModeConfig = new RunModeConfigDTO();
|
String environmentGroupId = testPlanRunRequest.getEnvironmentGroupId();
|
||||||
runModeConfig.setMode(testPlanRunRequest.getMode());
|
runModeConfig = getRunModeConfigDTO(testPlanRunRequest, envType, envMap, environmentGroupId, testPlanID);
|
||||||
runModeConfig.setReportType(testPlanRunRequest.getReportType());
|
|
||||||
if (testPlanRunRequest.getEnvMap() == null) {
|
|
||||||
runModeConfig.setEnvMap(new HashMap<>());
|
|
||||||
} else {
|
|
||||||
runModeConfig.setEnvMap(testPlanRunRequest.getEnvMap());
|
|
||||||
}
|
}
|
||||||
runModeConfig.setOnSampleError(testPlanRunRequest.isOnSampleError());
|
} catch (Exception e) {
|
||||||
|
LogUtil.error("获取测试计划保存的环境信息出错!", e);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
runModeConfig = buildRunModeConfigDTO();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (runModeConfig.getEnvMap() == null) {
|
|
||||||
runModeConfig.setEnvMap(new HashMap<>());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (planReportId == null) {
|
if (planReportId == null) {
|
||||||
|
@ -2129,7 +2126,6 @@ public class TestPlanService {
|
||||||
String testPlanId = testplanRunRequest.getTestPlanId();
|
String testPlanId = testplanRunRequest.getTestPlanId();
|
||||||
RunModeConfigDTO runModeConfig = getRunModeConfigDTO(testplanRunRequest, envType, envMap, environmentGroupId, testPlanId);
|
RunModeConfigDTO runModeConfig = getRunModeConfigDTO(testplanRunRequest, envType, envMap, environmentGroupId, testPlanId);
|
||||||
String apiRunConfig = JSONObject.toJSONString(runModeConfig);
|
String apiRunConfig = JSONObject.toJSONString(runModeConfig);
|
||||||
updatePlan(testplanRunRequest, testPlanId);
|
|
||||||
return this.run(testPlanId, testplanRunRequest.getProjectId(),
|
return this.run(testPlanId, testplanRunRequest.getProjectId(),
|
||||||
testplanRunRequest.getUserId(), testplanRunRequest.getTriggerMode(), testplanRunRequest.getReportId(), apiRunConfig);
|
testplanRunRequest.getUserId(), testplanRunRequest.getTriggerMode(), testplanRunRequest.getReportId(), apiRunConfig);
|
||||||
|
|
||||||
|
|
|
@ -814,7 +814,7 @@ export default {
|
||||||
param.headlessEnabled = config.headlessEnabled;
|
param.headlessEnabled = config.headlessEnabled;
|
||||||
if (config.isRun === true) {
|
if (config.isRun === true) {
|
||||||
this.$refs.taskCenter.open();
|
this.$refs.taskCenter.open();
|
||||||
this.result = this.$post('test/plan/run/', param, () => {
|
this.result = this.$post('test/plan/run/save', param, () => {
|
||||||
this.$success(this.$t('commons.run_success'));
|
this.$success(this.$t('commons.run_success'));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue