jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yevgeniy Grimaylo <>
Subject BeanShell Sampler jmx API method: setScript(string) does not set string into Script area of BeanShell GUI config element
Date Wed, 25 Oct 2017 15:26:40 GMT
I am trying to create jmeter jmx file at run time by using jmx api in java
I have the following code, which should create BeanShell Sampler gui config element with the
BeanShell Sampler name, comments and script itself
But, after script execution, I open generated by java jmx file, I noticed that only BeanShell
Sampler name and comments are shown, but not Script
So, my question is: how can I create BeanShell Sampler GUI Config element with actual script
shown under  Script Area ?
I am using jmeter jmx api version 3.3 and java 1.8
Java code fragment:
BeanShellSampler beanshell = new BeanShellSampler();
beanshell.setName("BeanShell Sampler");
beanshell.setComment("This is beanshell sampler");
beanshell.setScript("BeanShell scripting goes here");
beanshell.setProperty(TestElement.TEST_CLASS, BeanShellSampler.class.getName());
beanshell.setProperty(TestElement.GUI_CLASS, BeanShellSamplerGui.class.getName());
// Test Plan
TestPlan testPlan = new TestPlan(testPlanName);
testPlan.setProperty(TestElement.TEST_CLASS, TestPlan.class.getName());
testPlan.setProperty(TestElement.GUI_CLASS, TestPlanGui.class.getName());
testPlan.setUserDefinedVariables((Arguments) new ArgumentsPanel().createTestElement());
// Construct Test Plan from previously initialized elements
HashTree threadGroupHashTree = testPlanTree.add(testPlan, threadGroup);

Thanks in advance for your feedback
Yevgeniy Grimaylo
Staff QA Member
(617) 2854671
20 Park Plaza, Suite 1400
Boston, MA 02116
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message