Is there a way to reference a variable from one BeanShell Pre/Post-Processor to another BeanShell Processor (they are within the same Thread Group)?
If I create a String variable inside a BeanShell PreProcessor under an HTTP Request, can I then use or reference that variable inside a BeanShell PostProcessor under that same HTTP Request..?
I tried Accessing this variable in the following ways:
+ HTTP Request
+ BeanShell PreProcessor:
String preProcessor1_MYID = "Value_1";
+ BeanShell PostProcessor:
String postProcessor1_MYID = "Value_2";
//Try #1:
String tmp_preProcessor1_MYID = preProcessor1_MYID;
//Try #2:
String tmp_preProcessor1_MYID = ${preProcessor1_MYID};
//Try #3:
String tmp_preProcessor1_MYID = ${__V(preProcessor1_MYID)};
//Try #4:
String tmp_preProcessor1_MYID = vars.get("preProcessor1_MYID");
Is there a different function like ${__V()} or vars.get(), that I'm missing that I'm supposed to be using? I was also wondering if I needed a User Defined Variables object in order to share this variable between BeanShell Pre/PostProcessors but I wasn't sure. I also read about the ${__BeanShell()} function, but didn't think that was what I was looking for either... Any ideas? I would assume this should be possible, but was hoping I didn't need to add anything like the User-Defined Vars object.
Any thoughts or suggestion would be greatly appreciated!
Thanks in Advance,
Matt
If you need to use the value in other elements later,
store it in a vairable
vars.put("myvar", "value");
Now you can access it using
${myvar}
or in beanshell
vars.get("myvar")
.