I am trying to write a test plan, where a custom report is generated based on the text on the samplers. I could not scope the variables correctly in these three levels.
loc = vars.get("local_count");
if(loc == null){
vars.put("local_count", "1");//available only in local thread level
}else{
temp = Integer.parseInt(loc) + 1;
vars.put("local_count", temp.toString());
}
log.info("the local count is " + vars.get("local_count");
glo = props.get("global_count");
if(glo == null){
props.put("global_count", "1");//available in test plan level
}else{
temp1 = Integer.parseInt(glo) + 1;
props.put("global_count", temp1.toString());
}
log.info("the global count is " + props.get("global_count");
Now try creating multiple Thread-Group and add this BeanShell sampler in each of them.
How to make a variable available in all the threads of a Thread-Group only(not on other thread groups).Providing constant-unique names in different thread groups is not an option.?
Could somebody help me. Thanks in advance.
Add BeanShell Sampler and insert this code:
vars.put("test","abcd");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With