fix(接口测试): 脚本内容为空则不生成此步骤

--bug=1045251 --user=赵勇 [接口测试] github#32654接口脚本中添加了后置脚本,如果不写内容的话,控制台会报错 https://www.tapd.cn/55049933/s/1576615

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2024-09-10 15:57:16 +08:00 committed by Craftsman
parent bfc17f9eeb
commit 45dc407345
2 changed files with 14 additions and 4 deletions

View File

@ -33,16 +33,21 @@ public class MsJSR223PostProcessor extends MsTestElement {
@Override
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, MsParameter msParameter) {
ParameterConfig config = (ParameterConfig) msParameter;
if (StringUtils.isBlank(this.script)) {
return;
}
// 非导出操作且不是启用状态则跳过执行
if (!config.isOperating() && !this.isEnable()) {
return;
}
ScriptFilter.verify(this.getScriptLanguage(), this.getName(), script);
if (config.isOperating()) {
if (StringUtils.isNotEmpty(script) && script.startsWith(JMeterVars.class.getCanonicalName())) {
return;
}
}
// 非导出操作且不是启用状态则跳过执行
if (!config.isOperating() && !this.isEnable()) {
return;
}
this.setEnvironmentId(ElementUtil.getScriptEnv(this.getEnvironmentId(), config, this.getProjectId()));
TestElement processor = new BeanShellPostProcessor();

View File

@ -37,6 +37,11 @@ public class MsJSR223PreProcessor extends MsTestElement {
if (!config.isOperating() && !this.isEnable()) {
return;
}
if (StringUtils.isBlank(this.script)) {
return;
}
if (config.isOperating()) {
if (StringUtils.isNotEmpty(script) && script.startsWith(JMeterVars.class.getCanonicalName())) {
return;