refactor(接口测试): 代码编写优化
This commit is contained in:
parent
0c4a0b8b8b
commit
3774b91928
|
@ -155,12 +155,12 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
}
|
||||
|
||||
//处理全局前后置脚本(步骤内)
|
||||
String enviromentId = this.getEnvironmentId();
|
||||
if (enviromentId == null) {
|
||||
enviromentId = this.useEnvironment;
|
||||
String environmentId = this.getEnvironmentId();
|
||||
if (environmentId == null) {
|
||||
environmentId = this.useEnvironment;
|
||||
}
|
||||
//根据配置将脚本放置在私有脚本之前
|
||||
JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.JDBC.name(), enviromentId, config, false);
|
||||
JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.JDBC.name(), environmentId, config, false);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
|
@ -168,7 +168,7 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
});
|
||||
}
|
||||
//根据配置将脚本放置在私有脚本之后
|
||||
JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.JDBC.name(), enviromentId, config, true);
|
||||
JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.JDBC.name(), environmentId, config, true);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -150,12 +150,12 @@ public class MsTCPSampler extends MsTestElement {
|
|||
}
|
||||
|
||||
//处理全局前后置脚本(步骤内)
|
||||
String enviromentId = this.getEnvironmentId();
|
||||
if (enviromentId == null) {
|
||||
enviromentId = this.useEnvironment;
|
||||
String environmentId = this.getEnvironmentId();
|
||||
if (environmentId == null) {
|
||||
environmentId = this.useEnvironment;
|
||||
}
|
||||
//根据配置将脚本放置在私有脚本之前
|
||||
JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.TCP.name(), enviromentId, config, false);
|
||||
JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.TCP.name(), environmentId, config, false);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
|
@ -163,7 +163,7 @@ public class MsTCPSampler extends MsTestElement {
|
|||
});
|
||||
}
|
||||
//根据配置将脚本放置在私有脚本之后
|
||||
JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.TCP.name(), enviromentId, config, true);
|
||||
JMeterScriptUtil.setScript(envConfig, samplerHashTree, GlobalScriptFilterRequest.TCP.name(), environmentId, config, true);
|
||||
}
|
||||
|
||||
private void addItemHashTree(MsTestElement element, HashTree samplerHashTree, ParameterConfig config) {
|
||||
|
|
|
@ -673,6 +673,11 @@ public class ApiAutomationService {
|
|||
element.put("enable", enable);
|
||||
element.put("environmentEnable", environmentEnable);
|
||||
hashTree.set(i, element);
|
||||
} else {
|
||||
if (StringUtils.equalsIgnoreCase(element.getString("referenced"), "REF")) {
|
||||
element.put("enable", false);
|
||||
element.put("num", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (element.containsKey("hashTree")) {
|
||||
|
@ -695,6 +700,11 @@ public class ApiAutomationService {
|
|||
element.put("enable", enable);
|
||||
element.put("environmentEnable", environmentEnable);
|
||||
element.put("num", scenarioWithBLOBs.getNum());
|
||||
} else {
|
||||
if (StringUtils.equalsIgnoreCase(element.getString("referenced"), "REF")) {
|
||||
element.put("enable", false);
|
||||
element.put("num", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (element != null && element.containsKey("hashTree")) {
|
||||
|
|
|
@ -110,7 +110,7 @@ export default {
|
|||
this.isShowNum = true;
|
||||
this.getWorkspaceId(this.scenario.projectId);
|
||||
} else {
|
||||
this.isSameSpace = false;
|
||||
this.isShowNum = false;
|
||||
}
|
||||
if (!this.scenario.projectId) {
|
||||
this.scenario.projectId = getCurrentProjectID();
|
||||
|
|
Loading…
Reference in New Issue