Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is different between props and vars object in JMeter

Tags:

jmeter

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.

like image 946
Sarang Avatar asked Aug 09 '16 07:08

Sarang


People also ask

What is props in JMeter?

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.

What is vars get?

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.

What are JMeter variables?

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.

What is CTX in JMeter?

ctx is the most powerful variable exposed to BeanShell. It represents the org. apache. jmeter. threads.


1 Answers

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.

like image 93
Iske Avatar answered Sep 18 '22 18:09

Iske