fix(接口测试): 修复导入的自定义beanshell脚本没内容的缺陷

--bug=1020951 --user=王孝刚
【接口测试】接口场景中导入带BeanShell自定义脚本的jmx文件,beanshell自定义脚本建议和系统中原有的自定义脚本一样
https://www.tapd.cn/55049933/s/1317941
This commit is contained in:
wxg0103 2022-12-21 11:36:26 +08:00 committed by wxg0103
parent 5d32c091ee
commit f38545a650
1 changed files with 2 additions and 2 deletions

View File

@ -744,7 +744,7 @@ public class JMeterParser extends ApiImportAbstractParser<ScenarioImport> {
elementNode = new MsJSR223Processor(); elementNode = new MsJSR223Processor();
BeanUtils.copyBean(elementNode, jsr223Sampler); BeanUtils.copyBean(elementNode, jsr223Sampler);
((MsJSR223Processor) elementNode).setJsrEnable(false); ((MsJSR223Processor) elementNode).setJsrEnable(false);
((MsJSR223Processor) elementNode).setScript(jsr223Sampler.getPropertyAsString(ElementConstants.SCRIPT)); ((MsJSR223Processor) elementNode).setScript(jsr223Sampler.getPropertyAsString("BeanShellSampler.query"));
((MsJSR223Processor) elementNode).setScriptLanguage(jsr223Sampler.getPropertyAsString("scriptLanguage")); ((MsJSR223Processor) elementNode).setScriptLanguage(jsr223Sampler.getPropertyAsString("scriptLanguage"));
} }
// 后置脚本 // 后置脚本
@ -752,7 +752,7 @@ public class JMeterParser extends ApiImportAbstractParser<ScenarioImport> {
JSR223PostProcessor jsr223Sampler = (JSR223PostProcessor) key; JSR223PostProcessor jsr223Sampler = (JSR223PostProcessor) key;
elementNode = new MsJSR223PostProcessor(); elementNode = new MsJSR223PostProcessor();
BeanUtils.copyBean(elementNode, jsr223Sampler); BeanUtils.copyBean(elementNode, jsr223Sampler);
((MsJSR223PostProcessor) elementNode).setScript(jsr223Sampler.getPropertyAsString("BeanShellSampler.query")); ((MsJSR223PostProcessor) elementNode).setScript(jsr223Sampler.getPropertyAsString(ElementConstants.SCRIPT));
((MsJSR223PostProcessor) elementNode).setScriptLanguage(jsr223Sampler.getPropertyAsString("scriptLanguage")); ((MsJSR223PostProcessor) elementNode).setScriptLanguage(jsr223Sampler.getPropertyAsString("scriptLanguage"));
} else if (key instanceof BeanShellPostProcessor) { } else if (key instanceof BeanShellPostProcessor) {
elementNode = getMsTestElement((BeanShellPostProcessor) key); elementNode = getMsTestElement((BeanShellPostProcessor) key);