Im new in load and performance testing so could anyone explain me, what is difference between vars object and props object in JMeter beanshell script.
Im also bit confuse about JMeter variable and properties.
Thanks.
The setProperty function can be used to define a JMeter property. These are global to the test plan, so can be used to pass information between threads – should that be needed. Both variables and properties are case-sensitive.
vars. get() returns a string (even if the value of the variable is a number), vars. put() also takes a string value, so do not forget to convert them from string and to string.
JMeter variables are special placeholders that can be resolved to respective values. This means they are values that can be used inside the test and populated when the test runs. Unlike properties, variables are local to a thread and not common to all threads in the test.
ctx is the most powerful variable exposed to BeanShell. It represents the org. apache. jmeter. threads.
The most simplest explanation would be that variables(vars) are not shared between threads, and properties(props) ARE shared.
Usage:
vars - ( JMeterVariables) - gives read/write access to variables:
- vars.get(key);
vars.put(key,val);
vars.putObject("OBJ1",new Object());
vars.getObject("OBJ2");
props - (JMeterProperties - class java.util.Properties):
- props.get("START.HMS");
- props.put("PROP1","1234");
You can refer to this link to get more info on vars and props.
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