fix(接口测试): 修复前后置脚本设置环境变量问题
--bug=1046165 --user=赵勇 【接口测试】github#32999,复制的场景用例在复制的环境下执行时,变量 __metersphere_env_id 取到的环境ID不正确 https://www.tapd.cn/55049933/s/1583241 Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
parent
f92ad3f3a6
commit
3dfd699e0d
|
@ -47,7 +47,10 @@ public class MsJSR223PostProcessor extends MsTestElement {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 复制脚本环境ID未改变情况下,使用父级环境ID
|
||||
if (this.getParent() != null && !StringUtils.equals(this.getParent().getEnvironmentId(), this.getEnvironmentId())) {
|
||||
this.setEnvironmentId(this.getParent().getEnvironmentId());
|
||||
}
|
||||
this.setEnvironmentId(ElementUtil.getScriptEnv(this.getEnvironmentId(), config, this.getProjectId()));
|
||||
|
||||
TestElement processor = new BeanShellPostProcessor();
|
||||
|
|
|
@ -48,6 +48,10 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
|||
}
|
||||
}
|
||||
ScriptFilter.verify(this.getScriptLanguage(), this.getName(), script);
|
||||
// 复制脚本环境ID未改变情况下,使用父级环境ID
|
||||
if (this.getParent() != null && !StringUtils.equals(this.getParent().getEnvironmentId(), this.getEnvironmentId())) {
|
||||
this.setEnvironmentId(this.getParent().getEnvironmentId());
|
||||
}
|
||||
this.setEnvironmentId(ElementUtil.getScriptEnv(this.getEnvironmentId(), config, this.getProjectId()));
|
||||
|
||||
final HashTree jsr223PreTree = tree.add(getShellProcessor());
|
||||
|
|
Loading…
Reference in New Issue