Bean shell preprocessor to compare between threads

We add a thread group and in that add a request and bean shell preprocessor and in that define a jmeter property named url1.

And give it some value.

props.put("url2","www.google.com");

Now the plus point of jmeter property is that it can be shared between multiple test plans and thread groups.

So we add a new thread group and add a new http request sampler to it. Now to use the value of url defined in bean shell preprocessor of thread group1 we have to go to options ,function helper dialog and then choose

__property

In in name of property we tpe url because we want to generate a function for the System property named url1

After typing the name we press generate and a new fucntion will be generated

Now in thread group 2 in http request we type that function in server name so that what ever value is generated from property url1 ,http request will hit that value.

Similarly we have other functions in bean shell scripting to check value of a key or to check if a jkey or value actually exists in our jmeter properties or we can also check the total no of jmeter properties we have.

System.out.println(props.get("url2"));
System.out.println("The total no of properties are " + props.size());
System.out.println(props.containsKey("url2"));