jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yevgeniy Grimaylo <Yevgeniy.Grima...@synopsys.com>
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
Hello,
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.setEnabled(true);
beanshell.setProperty(TestElement.TEST_CLASS, BeanShellSampler.class.getName());
beanshell.setProperty(TestElement.GUI_CLASS, BeanShellSamplerGui.class.getName());
// Test Plan
TestPlan testPlan = new TestPlan(testPlanName);
testPlan.setEnabled(true);
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
testPlanTree.add(testPlan);
HashTree threadGroupHashTree = testPlanTree.add(testPlan, threadGroup);
threadGroupHashTree.add(beanshell);


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