How to create the utility bean shell script in jmeter. In Jmeter i have 5 thread group which is contains the bean shell samplers.i want to make use beanshell class across my thread group.The given below is sample beanshell class which is contains one method called add().
SampleBeanShell(){
int add(int a,int b){
return a+b;
}
return this;
}
obj=SampleBeanShell();
int result=obj.add(10,20);
log.info("REsult is"+result);
I would like to use the add() method in another in thread group bean sampler or bean shell assertion.
if (bsh.shared.myObj == void){
myObj=SampleBeanShell();
}
int result1=myObj.add(12,20);
log.info("REsult is"+result1);
I have added the above snippet,I am not able call this method in another bean sampler and another thread group as well.
int result=bsh.shared.myObj.add(20,21);
log.info("2.Bean sampler result"+result);

