fix(接口测试): 修复用例新增前后置步骤数据源切换错误问题
--bug=1012764 --user=赵勇 【接口测试】接口前后置sql添加后,再添加其他前后置操作,数据源会消失 https://www.tapd.cn/55049933/s/1148430
This commit is contained in:
parent
9b9ff8a266
commit
b40cd1c426
|
@ -95,7 +95,8 @@ public class ApiScenarioEnvService {
|
||||||
http.setUrl(StringUtils.equals(testElement.getRefType(), "CASE") ? null : http.getUrl());
|
http.setUrl(StringUtils.equals(testElement.getRefType(), "CASE") ? null : http.getUrl());
|
||||||
|
|
||||||
// 非全路径校验
|
// 非全路径校验
|
||||||
if (StringUtils.isBlank(http.getUrl()) || (http.getIsRefEnvironment() != null && http.getIsRefEnvironment())) {
|
if (!StringUtils.equalsIgnoreCase(http.getReferenced(), "Created") || (http.getIsRefEnvironment() != null &&
|
||||||
|
http.getIsRefEnvironment())) {
|
||||||
env.getProjectIds().add(http.getProjectId());
|
env.getProjectIds().add(http.getProjectId());
|
||||||
env.setFullUrl(false);
|
env.setFullUrl(false);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +133,8 @@ public class ApiScenarioEnvService {
|
||||||
if (StringUtils.equals(testElement.getType(), "HTTPSamplerProxy")) {
|
if (StringUtils.equals(testElement.getType(), "HTTPSamplerProxy")) {
|
||||||
// 校验是否是全路径
|
// 校验是否是全路径
|
||||||
MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) testElement;
|
MsHTTPSamplerProxy httpSamplerProxy = (MsHTTPSamplerProxy) testElement;
|
||||||
if (StringUtils.isBlank(httpSamplerProxy.getUrl()) || (httpSamplerProxy.getIsRefEnvironment() != null && httpSamplerProxy.getIsRefEnvironment())) {
|
if (!StringUtils.equalsIgnoreCase(httpSamplerProxy.getReferenced(), "Created") || (httpSamplerProxy.getIsRefEnvironment() != null &&
|
||||||
|
httpSamplerProxy.getIsRefEnvironment())) {
|
||||||
env.getProjectIds().add(httpSamplerProxy.getProjectId());
|
env.getProjectIds().add(httpSamplerProxy.getProjectId());
|
||||||
env.setFullUrl(false);
|
env.setFullUrl(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,7 +433,6 @@ public class ApiDefinitionExecResultService {
|
||||||
saveResult.setType(type);
|
saveResult.setType(type);
|
||||||
|
|
||||||
saveResult.setStatus(status);
|
saveResult.setStatus(status);
|
||||||
saveResult.setResourceId(item.getName());
|
|
||||||
saveResult.setStartTime(item.getStartTime());
|
saveResult.setStartTime(item.getStartTime());
|
||||||
saveResult.setEndTime(item.getEndTime());
|
saveResult.setEndTime(item.getEndTime());
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,8 @@ public class ApiExecutionQueueService {
|
||||||
if (report == null) {
|
if (report == null) {
|
||||||
executionQueueDetailMapper.deleteByPrimaryKey(item.getId());
|
executionQueueDetailMapper.deleteByPrimaryKey(item.getId());
|
||||||
}
|
}
|
||||||
if (report != null && StringUtils.equalsAnyIgnoreCase(report.getStatus(), TestPlanReportStatus.RUNNING.name(), APITestStatus.Waiting.name())
|
// 这里只处理已经开始执行的队列如果 报告状态是 Waiting 表示还没开始暂不处理
|
||||||
|
if (report != null && StringUtils.equalsAnyIgnoreCase(report.getStatus(), TestPlanReportStatus.RUNNING.name())
|
||||||
&& report.getUpdateTime() < timeout) {
|
&& report.getUpdateTime() < timeout) {
|
||||||
report.setStatus(ScenarioStatus.Timeout.name());
|
report.setStatus(ScenarioStatus.Timeout.name());
|
||||||
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||||
|
|
|
@ -1626,10 +1626,10 @@ export default {
|
||||||
this.sort();
|
this.sort();
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.cancelBatchProcessing();
|
this.cancelBatchProcessing();
|
||||||
if (isRefresh) {
|
|
||||||
this.reloadTree = getUUID();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
if (isRefresh) {
|
||||||
|
this.reloadTree = getUUID();
|
||||||
|
}
|
||||||
// 记录初始化数据
|
// 记录初始化数据
|
||||||
let v1 = {
|
let v1 = {
|
||||||
apiScenarioModuleId: this.currentScenario.apiScenarioModuleId,
|
apiScenarioModuleId: this.currentScenario.apiScenarioModuleId,
|
||||||
|
|
|
@ -291,7 +291,7 @@ export default {
|
||||||
this.$emit('refreshModule');
|
this.$emit('refreshModule');
|
||||||
},
|
},
|
||||||
setNewSource(environment, obj) {
|
setNewSource(environment, obj) {
|
||||||
if (environment.config && environment.config.databaseConfigs) {
|
if (environment.config && environment.config.databaseConfigs && environment.config.databaseConfigs.length > 0) {
|
||||||
let dataSources = environment.config.databaseConfigs.filter(item => item.name === obj.targetDataSourceName);
|
let dataSources = environment.config.databaseConfigs.filter(item => item.name === obj.targetDataSourceName);
|
||||||
if (dataSources && dataSources.length > 0) {
|
if (dataSources && dataSources.length > 0) {
|
||||||
obj.dataSourceId = dataSources[0].id;
|
obj.dataSourceId = dataSources[0].id;
|
||||||
|
|
|
@ -259,9 +259,12 @@ export default {
|
||||||
setOwnEnvironment(scenarioDefinition) {
|
setOwnEnvironment(scenarioDefinition) {
|
||||||
for (let i in scenarioDefinition) {
|
for (let i in scenarioDefinition) {
|
||||||
let typeArray = ["JDBCPostProcessor", "JDBCSampler", "JDBCPreProcessor"]
|
let typeArray = ["JDBCPostProcessor", "JDBCSampler", "JDBCPreProcessor"]
|
||||||
if (typeArray.indexOf(scenarioDefinition[i].type) !== -1) {
|
if (typeArray.indexOf(scenarioDefinition[i].type) !== -1
|
||||||
|
&& this.request.environmentId && !scenarioDefinition[i].environmentId) {
|
||||||
scenarioDefinition[i].environmentId = this.request.environmentId;
|
scenarioDefinition[i].environmentId = this.request.environmentId;
|
||||||
scenarioDefinition[i].dataSourceId = this.request.dataSourceId;
|
if (this.request.dataSourceId && !scenarioDefinition[i].dataSourceId) {
|
||||||
|
scenarioDefinition[i].dataSourceId = this.request.dataSourceId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue